use of org.openqa.selenium.remote.RemoteWebDriver in project selenium_java by sergueik.
the class TestBase method setUp.
@BeforeMethod
public void setUp() throws MalformedURLException {
threadDriver = new ThreadLocal<RemoteWebDriver>();
String browserName = "firefox";
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platform", Platform.ANY.toString());
capabilities.setCapability("browser", browserName);
capabilities.setBrowserName(browserName);
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capabilities);
threadDriver.set(driver);
}
use of org.openqa.selenium.remote.RemoteWebDriver in project selenium_java by sergueik.
the class App method setUp.
@Before
public void setUp() throws Exception {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platform", platform);
capabilities.setCapability("browser", browserName);
capabilities.setBrowserName(browserName);
capabilities.setCapability("browserVersion", browserVersion);
// org.openqa.selenium.WebDriverException: The best matching driver provider oenqa.selenium.chrome.ChromeDriver can't create a new driver instance for Caities [{platform=ANY, browserVersion=45, browser=firefox}]
driver = new RemoteWebDriver(new URL(hubUrl), capabilities);
}
use of org.openqa.selenium.remote.RemoteWebDriver in project ephemerals by LivePersonInc.
the class SeleniumParallelEphemeralTest method test.
@Test
public void test() throws Exception {
// Define fixed thread pool with SIZE=10
ExecutorService executor = Executors.newFixedThreadPool(10);
// Submit Ephemeral deployment tasks to cluster using thread pool
List<Future<RemoteWebDriver>> remoteWebDriverFutureList = new ArrayList<>();
for (int i = 0; i < 10; i++) {
Future<RemoteWebDriver> future = executor.submit(callableTask);
remoteWebDriverFutureList.add(future);
}
// Get result of all tasks
for (Future<RemoteWebDriver> future : remoteWebDriverFutureList) {
RemoteWebDriver remoteWebDriver = future.get();
remoteWebDriver.get("http://yahoo.com");
Assert.assertNotNull(remoteWebDriver.findElementById("uh-logo"));
remoteWebDriver.quit();
}
}
use of org.openqa.selenium.remote.RemoteWebDriver in project ephemerals by LivePersonInc.
the class SeleniumWithNginxTest method test.
@Test
public void test() throws IOException {
URL url = nginxResource.getEphemeral().get();
RemoteWebDriver browser = seleniumResource.get();
browser.get(url.toString() + "/index.html");
}
use of org.openqa.selenium.remote.RemoteWebDriver in project webmagic by code4craft.
the class WebDriverPool method configure.
/**
* Configure the GhostDriver, and initialize a WebDriver instance. This part
* of code comes from GhostDriver.
* https://github.com/detro/ghostdriver/tree/master/test/java/src/test/java/ghostdriver
*
* @author bob.li.0718@gmail.com
* @throws IOException
*/
public void configure() throws IOException {
// Read config file
sConfig = new Properties();
String configFile = DEFAULT_CONFIG_FILE;
if (System.getProperty("selenuim_config") != null) {
configFile = System.getProperty("selenuim_config");
}
sConfig.load(new FileReader(configFile));
// Prepare capabilities
sCaps = new DesiredCapabilities();
sCaps.setJavascriptEnabled(true);
sCaps.setCapability("takesScreenshot", false);
String driver = sConfig.getProperty("driver", DRIVER_PHANTOMJS);
// Fetch PhantomJS-specific configuration parameters
if (driver.equals(DRIVER_PHANTOMJS)) {
// "phantomjs_exec_path"
if (sConfig.getProperty("phantomjs_exec_path") != null) {
sCaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, sConfig.getProperty("phantomjs_exec_path"));
} else {
throw new IOException(String.format("Property '%s' not set!", PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY));
}
// "phantomjs_driver_path"
if (sConfig.getProperty("phantomjs_driver_path") != null) {
System.out.println("Test will use an external GhostDriver");
sCaps.setCapability(PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY, sConfig.getProperty("phantomjs_driver_path"));
} else {
System.out.println("Test will use PhantomJS internal GhostDriver");
}
}
// Disable "web-security", enable all possible "ssl-protocols" and
// "ignore-ssl-errors" for PhantomJSDriver
// sCaps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new
// String[] {
// "--web-security=false",
// "--ssl-protocol=any",
// "--ignore-ssl-errors=true"
// });
ArrayList<String> cliArgsCap = new ArrayList<String>();
cliArgsCap.add("--web-security=false");
cliArgsCap.add("--ssl-protocol=any");
cliArgsCap.add("--ignore-ssl-errors=true");
sCaps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, cliArgsCap);
// Control LogLevel for GhostDriver, via CLI arguments
sCaps.setCapability(PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_CLI_ARGS, new String[] { "--logLevel=" + (sConfig.getProperty("phantomjs_driver_loglevel") != null ? sConfig.getProperty("phantomjs_driver_loglevel") : "INFO") });
// 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);
}
}
Aggregations