我刚刚学会如何使用黄瓜。
你能告诉我如何完成这段代码吗?
您可以使用以下代码片段实现未定义步骤的步骤定义:
Then /^I take a screenshot$/ do
pending # express the regexp above with the code you wish you had
end
屏幕截图通常是在发生意外情况时进行的。您可能还需要捕获屏幕截图以在测试用例失败时进行报告。在这种特殊情况下,您应该在@After将为每个场景执行的方法。 Java,selenium 版本,
@After("@browser")
public void tearDown(Scenario scenario) {
if (scenario.isFailed()) {
final byte[] screenshot = ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.BYTES);
scenario.embed(screenshot, "image/png"); //stick it in the report
}
driver.close();
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)