selenium - I'm trying to validate all links on a webpage are working. How do I ignore a logout link -


the following method clicks on links of our application home page , validates working. problem logout link on page, can imagine once click test fails. there way can ignore or remove check of logout link? fyi logout first element in array. appreciated

public void checkalllinks() {

    driver.switchto().defaultcontent().switchto().frame("mainframe");     list<webelement> linkelements = driver.findelements(by.tagname("a"));      string[] linktexts = new string[linkelements.size()];      int = 0;      // extract link texts of each link element      (webelement e : linkelements) {          logger.info(linktexts[i] = e.gettext());          i++;      }     (string l : linktexts) {          driver.findelement(by.linktext(l)).click();          if (driver.gettitle().equals(title)) {              system.out.println("\"" + l + "\""              + " not working.");          } else {              system.out.println("\"" + l + "\""              + " working.");          }          driver.navigate().back();      } } 

if know it's first, add count , skip first:

i = 0; (string l : linktexts) {     if (i > 0) {         // ...     }     i++; } 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -