selenium - Table data identification using Xpath in mozilla browser -


i trying identifying table data below htmlcode

<!-- can use /goo.html have application context sensitive --> <!-- add custom tag lib's required of project down below --> <div id="specialhandlingtablewrapper" style="height: 401px;"> <div id="specialhandlingtableheader" style="width: 636px; position: relative; top: 0px; z-index: 10; vertical-align: top; height: 170px;"> <table id="specialhandlingselectiontable" class="table table-striped table-hover table-striped data-table"> <thead> <tbody> <tr> <td class="itemnamecell">sod catalog test code1 not inbound</td> <td class="skucell">sod_catalog_special_handling</td> <td/> <td/> <td/> </tbody> </table> </div> 

i need 3rd column data , below xpath written same

@findby(xpath = "//table[@id='specialhandlingselectiontable' , class='table table-striped table-hover table-striped data-table']/tr[1]/td[3]")  public webelement firsthandlinginstr; 

and interesting part seeing 2 matching nodes after defining tr , td values.please me here!

your xpath expression not match input, i'm surprised you're getting result anyway. stated in comments, in seems reason returns elements of both table header , body elements (which shouldn't query @ all).

for getting third table cell of first row in (each) table body, use query:

//table[@id='specialhandlingselectiontable']/tbody/tr[1]/tr[3] 

if there multiple table body elements, , want query first row of of them:

(//table[@id='specialhandlingselectiontable']/tbody/tr)[1]/tr[3] 

if want query table headers instead, replace tbody theader.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -