'当我尝试断言某些web元素时,如果断言失败,则黄瓜会停止执行并显示错误
AssertionError:'567'='abc'
功能文件:
Scenario: Validation of button
Given I hit login page
When login page gets loaded
Then validate text on button
Scenario:Login to the page
Given user provide login details
When clicks on login button
Then sign in the user
黄瓜突然停止,并且没有显示通过步骤的结果。
如果断言失败,我想去黄瓜执行下一步。请帮助并谢谢。'
使用步骤示例进行更新:
this.Then(/^Validate text on button$/, function() {
var textonbutton = browser.driver.findElement(by.xpath("it's xpath"));
textonbutton.getText('innerText').then(function(innerText) {
return assert.equal(innerText, "567");
});
});