Created
May 12, 2013 04:39
-
-
Save grimrose/5562439 to your computer and use it in GitHub Desktop.
ChromeDriverの動作確認。参照先 -> https://code.google.com/p/chromedriver/wiki/GettingStarted
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
package chromedriver; | |
import org.junit.Test; | |
import org.openqa.selenium.By; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.WebElement; | |
import org.openqa.selenium.chrome.ChromeDriver; | |
public class ChromeDriverTest { | |
@Test | |
public void testGoogleSearch() throws InterruptedException { | |
String userDir = System.getProperty("user.dir"); | |
// Optional, if not specified, WebDriver will search your path for chromedriver. | |
System.setProperty("webdriver.chrome.driver", userDir + "/driver/chromedriver"); | |
WebDriver driver = new ChromeDriver(); | |
driver.get("http://www.google.com/xhtml"); | |
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! | |
driver.quit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment