use of org.openqa.selenium.remote.RemoteWebDriver in project testcontainers-java by testcontainers.
the class LocalServerWebDriverContainerTest method testConnection.
@Test
public void testConnection() throws InterruptedException {
RemoteWebDriver driver = chrome.getWebDriver();
// Construct a URL that the browser container can access
String hostIpAddress = chrome.getTestHostIpAddress();
driver.get("http://" + hostIpAddress + ":" + localPort);
String headingText = driver.findElement(By.cssSelector("h1")).getText().trim();
assertEquals("The hardcoded success message was found on a page fetched from a local server", "It worked", headingText);
}
use of org.openqa.selenium.remote.RemoteWebDriver in project testcontainers-java by testcontainers.
the class BaseWebDriverContainerTest method setupDriverFromRule.
@NotNull
private static RemoteWebDriver setupDriverFromRule(BrowserWebDriverContainer rule) {
RemoteWebDriver driver = rule.getWebDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
return driver;
}
use of org.openqa.selenium.remote.RemoteWebDriver in project testcontainers-java by testcontainers.
the class BrowserWebDriverContainer method containerIsStarted.
@Override
protected void containerIsStarted(InspectContainerResponse containerInfo) {
driver = Unreliables.retryUntilSuccess(30, TimeUnit.SECONDS, Timeouts.getWithTimeout(10, TimeUnit.SECONDS, () -> () -> new RemoteWebDriver(getSeleniumAddress(), desiredCapabilities)));
if (vncRecordingContainer != null) {
LOGGER.debug("Starting VNC recording");
vncRecordingContainer.start();
}
}
use of org.openqa.selenium.remote.RemoteWebDriver in project ghostdriver by detro.
the class BaseTest method prepareDriver.
@Before
public void prepareDriver() throws Exception {
// Which driver to use? (default "phantomjs")
String driver = sConfig.getProperty("driver", DRIVER_PHANTOMJS);
// Start appropriate Driver
if (isUrl(driver)) {
sCaps.setBrowserName("phantomjs");
mDriver = new RemoteWebDriver(new URL(driver), sCaps);
} else if (driver.equals(DRIVER_FIREFOX)) {
mDriver = new FirefoxDriver(sCaps);
} else if (driver.equals(DRIVER_CHROME)) {
mDriver = new ChromeDriver(sCaps);
} else if (driver.equals(DRIVER_PHANTOMJS)) {
mDriver = new PhantomJSDriver(sCaps);
}
}
use of org.openqa.selenium.remote.RemoteWebDriver in project java.webdriver by sayems.
the class BrowserThreads method instantiateWebDriver.
private void instantiateWebDriver(DesiredCapabilities desiredCapabilities) {
log.info(" ");
log.info("Current Operating System: " + operatingSystem);
log.info("Current Architecture: " + systemArchitecture);
log.info("Current Browser Selection: " + selectedDriverType);
log.info(" ");
if (useRemoteWebDriver) {
URL seleniumGridURL = null;
try {
seleniumGridURL = new URL(System.getProperty("gridURL"));
} catch (MalformedURLException e) {
log.error("Either no legal protocol could be found or the string could not be parsed.", e);
}
String desiredBrowserVersion = System.getProperty("desiredBrowserVersion");
String desiredPlatform = System.getProperty("desiredPlatform");
if (null != desiredPlatform && !desiredPlatform.isEmpty()) {
desiredCapabilities.setPlatform(Platform.valueOf(desiredPlatform.toUpperCase()));
}
if (null != desiredBrowserVersion && !desiredBrowserVersion.isEmpty()) {
desiredCapabilities.setVersion(desiredBrowserVersion);
}
webdriver = new RemoteWebDriver(seleniumGridURL, desiredCapabilities);
} else {
webdriver = selectedDriverType.browser.getWebDriverObject(desiredCapabilities);
}
webdriver.manage().window().setSize(new Dimension(1280, 1024));
setup();
}
Aggregations