@Test
public void testWikipediaJUnit4_test1() throws Exception {
driver.get(baseURL + "/");
driver.findElement(By.id("searchInput")).clear();
driver.findElement(By.id("searchInput")).sendKeys("blueberries");
takeScreenShot("blueberry2.png"); // Capture screenshot of current state
driver.findElement(By.name("go")).click();
driver.findElement(By.cssSelector("p > i > a[title=\"Vaccinium\"]")).click();
takeScreenShot("vaccinium2.png"); // Capture screenshot of current state
driver.findElement(By.linkText("huckleberry")).click();
takeScreenShot("huckleberry2.png"); // Capture screenshot of current state
}
private void takeScreenShot(String fname) throws Exception {
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
String imageFileDir = System.getProperty("selenium.screenshot.dir");
if (imageFileDir == null)
imageFileDir = System.getProperty("java.io.tmpdir");
FileUtils.copyFile(scrFile, new File(imageFileDir, fname));
}
|
Jazz.net 채널 User Education 채널 |
Agile 학습 서클 학습 서클 |
developerWorks 포럼 |
배치 위키 지원 센터 블로그 |