【发布时间】:2013-12-06 23:09:45
【问题描述】:
我正在使用页面对象模型 (POM) 设计模式和 Selenium Webdriver。我想在 Catch 块中 assertion failed 时捕获屏幕截图,如下所示
try{
WebElement element = driver.findElement(By.xpath("//html/body/table[2]/form/table/tbody/tr/td/font"));
String strngAcc = element.getText();
System.out.println(strngAcc);
AssertJUnit.assertEquals("Account Information Created Successfully",strngAcc);
}
catch(WebDriverException ex) {
// Take **Screen Shot** here by Calling ScreenShot Capture Method
}
屏幕截图捕获是否在并行执行中工作?
帮助我提供屏幕截图捕获方法并在 Catch 块中调用该方法
【问题讨论】:
-
用Praveen提到的方法并行执行不行吗?
-
屏幕截图可以并行执行,使用/不使用基于您正在使用的 POM 自动化架构的网格
-
我在整个白色背景页面的四分之一部分获取屏幕截图。有什么方法可以让 ScreenShot 适合整个页面?
标签: java selenium selenium-webdriver selenium-grid