Search in sources :

Example 56 with ChromeDriver

use of org.openqa.selenium.chrome.ChromeDriver in project jmeter-plugins by undera.

the class ChromeDriverConfigTest method shouldNotCreateChromeWhenStartingServiceThrowsAnException.

@Test
public void shouldNotCreateChromeWhenStartingServiceThrowsAnException() throws Exception {
    ChromeDriverService.Builder mockServiceBuilder = mock(ChromeDriverService.Builder.class);
    whenNew(ChromeDriverService.Builder.class).withNoArguments().thenReturn(mockServiceBuilder);
    when(mockServiceBuilder.usingDriverExecutable(isA(File.class))).thenReturn(mockServiceBuilder);
    ChromeDriverService mockService = mock(ChromeDriverService.class);
    when(mockServiceBuilder.build()).thenReturn(mockService);
    doThrow(new IOException("Stubbed exception")).when(mockService).start();
    final ChromeDriver browser = config.createBrowser();
    assertThat(browser, is(nullValue()));
    assertThat(config.getServices(), is(Collections.<String, ChromeDriverService>emptyMap()));
    verify(mockServiceBuilder, times(1)).build();
}
Also used : ChromeDriverService(org.openqa.selenium.chrome.ChromeDriverService) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 57 with ChromeDriver

use of org.openqa.selenium.chrome.ChromeDriver in project divolte-collector by divolte.

the class SeleniumTestBase method setupLocalChrome.

private void setupLocalChrome() {
    System.setProperty("webdriver.chrome.driver", Optional.ofNullable(System.getenv(CHROME_DRIVER_LOCATION_ENV_VAR)).orElseThrow(() -> new RuntimeException("When using 'chrome' as Selenium driver, please set the location of the " + "Chrome driver manager server thingie in the env var: " + CHROME_DRIVER_LOCATION_ENV_VAR)));
    driver = new ChromeDriver();
}
Also used : ChromeDriver(org.openqa.selenium.chrome.ChromeDriver)

Example 58 with ChromeDriver

use of org.openqa.selenium.chrome.ChromeDriver in project trainning by fernandotomasio.

the class DriverFactory method getDriver.

public static WebDriver getDriver() {
    System.setProperty("webdriver.chrome.driver", "C:\\chromedriver_win32\\chromedriver.exe");
    WebDriver driver = new ChromeDriver();
    driver.get("http://localhost:8080/trainning-webapp");
    driver.findElement(By.name("j_username")).sendKeys("fernandofot");
    driver.findElement(By.name("j_password")).sendKeys("roland");
    driver.findElement(By.name("j_username")).submit();
    return driver;
}
Also used : WebDriver(org.openqa.selenium.WebDriver) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver)

Example 59 with ChromeDriver

use of org.openqa.selenium.chrome.ChromeDriver in project java-client by appium.

the class DesktopBrowserCompatibilityTest method chromeTest.

@Test
public void chromeTest() {
    WebDriver driver = new ChromeDriver();
    try {
        PageFactory.initElements(new AppiumFieldDecorator(driver, 15, TimeUnit.SECONDS), this);
        driver.get(new File("src/test/java/io/appium/java_client/hello appium - saved page.htm").toURI().toString());
        assertNotEquals(0, foundLinks.size());
        assertNotEquals(0, main.size());
        assertEquals(null, trap1);
        assertEquals(null, trap2);
    } finally {
        driver.quit();
    }
}
Also used : WebDriver(org.openqa.selenium.WebDriver) AppiumFieldDecorator(io.appium.java_client.pagefactory.AppiumFieldDecorator) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver) ChromeDriverPathUtil.getChromeDriver(io.appium.java_client.ChromeDriverPathUtil.getChromeDriver) File(java.io.File) Test(org.junit.Test)

Example 60 with ChromeDriver

use of org.openqa.selenium.chrome.ChromeDriver in project java-client by appium.

the class TimeoutTest method setUp.

/**
 * The setting up.
 */
@Before
public void setUp() {
    setProperty(ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY, getChromeDriver().getAbsolutePath());
    driver = new ChromeDriver();
    timeOutDuration = new TimeOutDuration(DEFAULT_TIMEOUT, DEFAULT_TIMEUNIT);
    initElements(new AppiumFieldDecorator(driver, timeOutDuration), this);
}
Also used : AppiumFieldDecorator(io.appium.java_client.pagefactory.AppiumFieldDecorator) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver) ChromeDriverPathUtil.getChromeDriver(io.appium.java_client.ChromeDriverPathUtil.getChromeDriver) TimeOutDuration(io.appium.java_client.pagefactory.TimeOutDuration) Before(org.junit.Before)

Aggregations

ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)91 ChromeOptions (org.openqa.selenium.chrome.ChromeOptions)41 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)39 File (java.io.File)33 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)27 WebDriver (org.openqa.selenium.WebDriver)24 HashMap (java.util.HashMap)21 Before (org.junit.Before)13 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)13 URL (java.net.URL)11 FirefoxProfile (org.openqa.selenium.firefox.FirefoxProfile)11 InternetExplorerDriver (org.openqa.selenium.ie.InternetExplorerDriver)11 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)11 Test (org.junit.Test)10 ChromeDriverService (org.openqa.selenium.chrome.ChromeDriverService)9 Actions (org.openqa.selenium.interactions.Actions)9 PhantomJSDriver (org.openqa.selenium.phantomjs.PhantomJSDriver)9 HtmlUnitDriver (org.openqa.selenium.htmlunit.HtmlUnitDriver)8 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)7 SafariDriver (org.openqa.selenium.safari.SafariDriver)7