use of org.openqa.selenium.remote.RemoteWebDriver in project page-factory-2 by sbtqa.
the class TagWebDriver method createRemoteWebDriver.
private static WebDriver createRemoteWebDriver(String webDriverUrl, DesiredCapabilities capabilities) throws MalformedURLException {
URL remoteUrl = new URL(webDriverUrl);
capabilities.merge(new SelenoidCapabilitiesParser().parse());
return new RemoteWebDriver(remoteUrl, capabilities);
}
use of org.openqa.selenium.remote.RemoteWebDriver in project mamute by caelum.
the class AcceptanceTestBase method ghostDriver.
private static WebDriver ghostDriver() {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setJavascriptEnabled(true);
capabilities.setCapability("takesScreenshot", true);
try {
return new RemoteWebDriver(new URL("http://localhost:8787/"), capabilities);
} catch (MalformedURLException e) {
throw new RuntimeException("could not build ghost driver", e);
}
}
use of org.openqa.selenium.remote.RemoteWebDriver in project jmeter-plugins by undera.
the class RemoteDriverConfigTest method shouldCreateRemoteDriver.
@Test
public void shouldCreateRemoteDriver() throws Exception {
config.setSeleniumGridUrl("http://my.awesomegrid.com");
RemoteWebDriver mockRemoteWebDriver = Mockito.mock(RemoteWebDriver.class);
whenNew(RemoteWebDriver.class).withParameterTypes(URL.class, Capabilities.class).withArguments(isA(URL.class), isA(Capabilities.class)).thenReturn(mockRemoteWebDriver);
final RemoteWebDriver browser = config.createBrowser();
assertThat(browser, is(mockRemoteWebDriver));
verifyNew(RemoteWebDriver.class, times(1)).withArguments(isA(URL.class), isA(Capabilities.class));
}
use of org.openqa.selenium.remote.RemoteWebDriver in project divolte-collector by divolte.
the class SeleniumTestBase method setupSauceLabs.
private void setupSauceLabs() throws MalformedURLException {
final String sauceUserName = Optional.ofNullable(System.getenv(SAUCE_USER_NAME_ENV_VAR)).orElseThrow(() -> new RuntimeException("When using 'sauce' as Selenium driver, please set the SauceLabs username " + "in the " + SAUCE_USER_NAME_ENV_VAR + " env var."));
final String sauceApiKey = Optional.ofNullable(System.getenv(SAUCE_API_KEY_ENV_VAR)).orElseThrow(() -> new RuntimeException("When using 'sauce' as Selenium driver, please set the SauceLabs username " + "in the " + SAUCE_API_KEY_ENV_VAR + " env var."));
final String sauceHost = Optional.ofNullable(System.getenv(SAUCE_HOST_ENV_VAR)).orElse("localhost");
final int saucePort = Optional.ofNullable(System.getenv(SAUCE_PORT_ENV_VAR)).map(Ints::tryParse).orElse(4445);
final DesiredCapabilities caps = capabilities.get();
// Note: getMethodName() is misleading. It's really the formatted name from the @Parameters annotation.
caps.setCapability("name", String.format("%s: %s", getClass().getSimpleName(), testName.getMethodName()));
caps.setCapability("public", "team");
caps.setCapability("videoUploadOnPass", false);
final RemoteWebDriver remoteDriver = new RemoteWebDriver(new URL(String.format("http://%s:%s@%s:%d/wd/hub", sauceUserName, sauceApiKey, sauceHost, saucePort)), caps);
final String sauceJobId = remoteDriver.getSessionId().toString();
final SauceREST sauce = new SauceREST(sauceUserName, sauceApiKey);
driver = remoteDriver;
testResultHook = Optional.of(result -> {
switch(result) {
case Passed:
sauce.jobPassed(sauceJobId);
break;
case Skipped:
sauce.deleteJob(sauceJobId);
break;
case Failed:
sauce.jobFailed(sauceJobId);
}
});
}
use of org.openqa.selenium.remote.RemoteWebDriver in project divolte-collector by divolte.
the class SeleniumTestBase method setupBrowserStack.
private void setupBrowserStack() throws MalformedURLException {
final String bsUserName = Optional.ofNullable(System.getenv(BS_USER_NAME_ENV_VAR)).orElseThrow(() -> new RuntimeException("When using 'browserstack' as Selenium driver, please set the BrowserStack username " + "in the " + BS_USER_NAME_ENV_VAR + " env var."));
final String bsApiKey = Optional.ofNullable(System.getenv(BS_API_KEY_ENV_VAR)).orElseThrow(() -> new RuntimeException("When using 'browserstack' as Selenium driver, please set the BrowserStack username " + "in the " + BS_API_KEY_ENV_VAR + " env var."));
final DesiredCapabilities caps = capabilities.get();
// Note: getMethodName() is misleading. It's really the formatted name from the @Parameters annotation.
caps.setCapability("job-name", String.format("%s: %s", getClass().getSimpleName(), testName.getMethodName()));
driver = new RemoteWebDriver(new URL(String.format("http://%s:%s@hub.browserstack.com/wd/hub", bsUserName, bsApiKey)), caps);
}
Aggregations