java - How to read click multiple same href to get the value using findby element using css -


    <a href="test.aspx?id=1">testdress</a>     <a href="test.aspx?id=2">testdress</a> 

testdress found in various place in page.

this 1 shows link.

@findby(how = how.css,using = "a[href='test.aspx']") 

link not click

cachelookup

@findby(how = how.css,using = "a[href='test.aspx']")     webelement testlink;      public void clickdress()     {         system.out.println("testlink"+testlink);         testlink.click();      } 

calliing code:

dashboardpage= pagefactory.initelements(driver, dashboardpage.class); dashboardpage.clickdress(); 

error: marionette info new connections no longer accepted

as have mentioned testdress found in various place in page while formatting html have stripped off parent node id , <span> tags. assuming href attributes unique each node following should work:

@findby(how = how.css,using = "a[href='test.aspx?id=1']") @cachelookup webelement testlink;  public void clickdress() {     system.out.println("testlink"+testlink);     testlink.click();  } 

and

@findby(how = how.css,using = "a[href='test.aspx?id=2']") @cachelookup webelement testlink;  public void clickdress() {     system.out.println("testlink"+testlink);     testlink.click();  } 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -