Skip to content

Instantly share code, notes, and snippets.

@LusciousPear
Created December 23, 2016 02:29
Show Gist options
  • Save LusciousPear/f5e24b34f91a5e3d6891c6b5f829b55b to your computer and use it in GitHub Desktop.
Save LusciousPear/f5e24b34f91a5e3d6891c6b5f829b55b to your computer and use it in GitHub Desktop.
@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!
}
catch (InterruptedException e) {
e.printStackTrace();
}
}
@Test
public void doPool(){
ExecutorService executor = Executors.newFixedThreadPool(10);
executor.submit(() -> {
testGoogleSearch();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment