Created
December 23, 2016 02:29
-
-
Save LusciousPear/f5e24b34f91a5e3d6891c6b5f829b55b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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