java - Selenium WebDriver -- How can I know a certain line has executed successfully? -


i testing web application , sample test case has 3 steps:

  1. enter username
  2. enter password
  3. click 'login'

    driver.findelement(by.id("username")).sendkeys(username); driver.findelement(by.id("password")).sendkeys(password); driver.findelement(by.id("loginbutton")).click(); 

i need generate report specifies steps passed , failed. there mechanism can know each of lines executed successfully? selenium have kind of inbuilt activity/event listener?

if want log basic steps click, navigate, on find element, etc

i recommend add event listener. can use class eventfiringwebdriver.

an example:

eventfiringwebdriver events = new eventfiringwebdriver(this._driver);     events.navigated += new eventhandler<webdrivernavigationeventargs>(eventafternavigate); 

and can define event handler as

private void eventafternavigate(object sender, webdrivernavigationeventargs e) {    log("url visited: " + e.driver.url);  // call favourite log method } 

you can find more possible event handlers in webdriver api reference: http://selenium.googlecode.com/svn/trunk/docs/api/dotnet/html/allmembers_t_openqa_selenium_support_events_eventfiringwebdriver.htm


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -