javascript - How to react to the fail condition while testing with Selenium WebDriver? -
here test login feature of nodejs application:
var webdriver = require('selenium-webdriver'); var driver = new webdriver.builder(). withcapabilities(webdriver.capabilities.chrome()). build(); driver.get('localhost:3012'); var loginform = driver.findelement(webdriver.by.id('login')); loginform.findelement(webdriver.by.name('email')).sendkeys('abcd@abcd.com'); loginform.findelement(webdriver.by.name('password')).sendkeys('1234s'); loginform.submit(); driver.wait(function() { return driver.findelement(webdriver.by.id('welcomemsg')) !== null; }, 1000); driver.quit();
if login successful, alright.
but if fails, test never stops.
how deal this?
(note: there no documentation of api selenium webdriver js find. had ask here.)
Comments
Post a Comment