-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Closed
Description
Meta -
OS: Ubuntu 16.04
Selenium Version: 3.0.1
Browser: Chrome
Browser Version: 55.0.2883.75 (64-bit)
Expected Behavior -
Multiple Chrome windows should open.
Actual Behavior -
No Chrome windows open.
Steps to reproduce -
I'm unable to get Selenium+ChromeDriver working inside an ExecutorService. This is so I can run multiple processes. It works just fine if I run it as a JUnit test inside a single thread.
There are no errors -- it runs fine until the WebDriver driver = new ChromeDriver(), and then just quits. No exceptions thrown.
To reproduce, just execute doPool().
@Test
public void doPool(){
ExecutorService executor = Executors.newFixedThreadPool(10);
executor.submit(() -> {
testGoogleSearch();
});
}
@Test
public void testGoogleSearch() {
//System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
String threadName = Thread.currentThread().getName();
System.out.println("Hello " + threadName);
WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com/xhtml");
try {
Thread.sleep(5000); // Let the user actually see something!
WebElement searchBox = driver.findElement(By.name("q"));
searchBox.sendKeys("ChromeDriver");
searchBox.submit();
Thread.sleep(5000); // Let the user actually see something!
screenshot(driver);
}
catch (InterruptedException e) {
e.printStackTrace();
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels