List of usage examples for org.openqa.selenium.chrome ChromeDriver ChromeDriver
public ChromeDriver()
From source file:org.craftercms.cstudio.share.selenium.forms.WaterfallSelectorTest.java
License:Open Source License
@Ignore @Test public void test_on_chrome() { test_waterfall_selector(new ChromeDriver()); }
From source file:org.craftercms.cstudio.share.selenium.forms.YesNoDropdownTest.java
License:Open Source License
@Ignore @Test public void test_on_chrome() { test_yes_no_dropdown(new ChromeDriver()); }
From source file:org.dojoserverfaces.test.support.selenium.DojoServerFacesSeleniumTestCase.java
License:Open Source License
/** * Performs test setup.//from www.j a v a 2 s.co m * * @param contextRootProperty a String containing the context root to * associate with this test case. * @throws Exception if an error occurs while performing test setup. */ protected void setUpTestCase(String contextRootProperty) throws Exception { String browser; String serverHost; int serverPort = 8080; // Collect the test parameters (hosts and ports). browser = System.getProperty(DojoServerFacesSeleniumTestCase.PARAM_BROWSER); serverHost = System.getProperty(DojoServerFacesSeleniumTestCase.PARAM_HOST_SERVER); if (browser == null) { browser = "chrome"; } browser = browser.toLowerCase().trim(); if (serverHost == null) { serverHost = "localhost"; } try { serverPort = Integer.parseInt(System.getProperty(DojoServerFacesSeleniumTestCase.PARAM_PORT_SERVER)); } catch (Throwable e) { // Ignore, we have defaults. } // Set up the context root. this.contextRoot = System.getProperty(contextRootProperty); if (this.contextRoot == null) { this.contextRoot = ""; } if (browser.equals("chrome")) { this.driver = new ChromeDriver(); } else if (browser.equals("firefox")) { this.driver = new FirefoxDriver(); } else if (browser.equals("htmlunit")) { this.driver = new HtmlUnitDriver(); ((HtmlUnitDriver) this.driver).setJavascriptEnabled(true); } // Create the Selenium object. this.selenium = new WebDriverBackedSelenium(this.driver, "http://" + serverHost + ":" + serverPort + "/"); }
From source file:org.eclipse.packagedrone.testing.server.TestSuite.java
License:Open Source License
@BeforeClass public static void startBrowser() throws MalformedURLException { if (SAUCE_USER_NAME != null) { driver = createSauce(Platform.fromString(SAUCE_PLATFORM), SAUCE_BROWSER, null); } else {//from w w w. j a va 2s .c om // driver = new MarionetteDriver (); driver = new ChromeDriver(); } }
From source file:org.ehoffman.testing.sample.WebDriverFactory.java
License:Apache License
/** * Returns a {@link WebDriver} instance built to the input specifications. * /*from w ww . j a v a 2 s . co m*/ * @param type the type of {@link WebDriver}. * @return a {@link WebDriver} instance ready for use. */ public WebDriver buildWebdriver(final Driver type, final String url) { WebDriver driver = null; switch (type) { case CHROME: driver = new ChromeDriver(); break; case FIREFOX: driver = new FirefoxDriver(); break; case PHANTOMJS: default: driver = new PhantomJSDriver(); break; } driver.manage().timeouts().implicitlyWait(0, TimeUnit.NANOSECONDS); driver.navigate().to(url); return driver; }
From source file:org.eweb4j.spiderman.plugin.util.WebDriverDownloader.java
License:Apache License
public void init(SpiderConfig config, Site _site) { this.config = config; String opt = _site.getOption("webdriver.chrome.driver"); System.getProperties().setProperty("webdriver.chrome.driver", opt); client = new ChromeDriver(); if (_site != null) { this.site = _site; if (this.site.getHeaders() != null && this.site.getHeaders().getHeader() != null) { for (org.eweb4j.spiderman.xml.Header header : this.site.getHeaders().getHeader()) { this.addHeader(header.getName(), header.getValue()); }//from ww w. ja va2s . co m } if (this.site.getCookies() != null && this.site.getCookies().getCookie() != null) { for (org.eweb4j.spiderman.xml.Cookie cookie : this.site.getCookies().getCookie()) { this.addCookie(cookie.getName(), cookie.getValue(), cookie.getHost(), cookie.getPath()); } } } }
From source file:org.iproduct.eshop.selenium.NewSeleneseIT.java
@Before public void setUp() { driver = new ChromeDriver(); }
From source file:org.joinfaces.example.view.AbstractPageIT.java
License:Apache License
private static WebDriver getChromeDriver() { ChromeDriverManager.getInstance().setup(); return new ChromeDriver(); }
From source file:org.julianharty.accessibility.automation.Example.java
License:Apache License
/** * Simple program to allow quick assessments of web pages. * @param args Command Line parameters./*w w w. j a v a2s.co m*/ */ public static void main(String[] args) { if (args.length >= 2) { maxTabsToEnter = Integer.parseInt(args[1]); } else { maxTabsToEnter = 50; } if (args.length >= 1) { urlToVisit = args[0]; } else { urlToVisit = "http://www.google.com"; } WebDriver driver = new ChromeDriver(); driver.get(urlToVisit); File screenshotFileBeforeTest = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); System.out.println(screenshotFileBeforeTest.getPath()); try { int tabs = KeyboardHelpers.tabThroughWebPage(driver, maxTabsToEnter); System.out.println(tabs + " were issued."); } catch (InterruptedException e) { e.printStackTrace(); } catch (WebDriverException wde) { wde.printStackTrace(); } File screenshotFileAfterTest = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); System.out.println(screenshotFileAfterTest.getPath()); }
From source file:org.julianharty.accessibility.automation.GoogleSearchResults.java
License:Apache License
public void testTabbingThroughGoogleSearchResults() throws InterruptedException { WebDriver driver = new ChromeDriver(); driver.get("http://www.google.co.uk/search?q=cheese"); int maxTabsToEnter = MAXIMUM_TAB_COUNT; int tabs = KeyboardHelpers.tabThroughWebPage(driver, maxTabsToEnter); assertTrue(String.format("Expected at least %02d tabs, only needed " + tabs, MINIMUM_TAB_COUNT), tabs > MINIMUM_TAB_COUNT); }