namratha Mk
namratha Mk

Reputation: 23

writing xpath for getting a row in a table

If I write the XPath for a row in a table which is expandable, like each row is expandable on the table. it has a dropdown. if I click on the dropdown of the row, I get to see some stuff inside it.

if I want to write XPath for the body inside the dropdown. ex: for the second row, I get it by writing the XPath:

//div[@class=‘react-bs-container-body’]//tbody/tr[2]

If i write the following xpath :

//div[@class=‘react-bs-container-body’]//tbody/tr[td[@tabindex="7"]]

where I am trying to access the same thing by giving the attribute of the column which is unique. Xpath should give me the body inside the dropdown.

but this is not happening. The second case won't work. Can anyone tell me why?

Upvotes: 0

Views: 1026

Answers (1)

Lishani
Lishani

Reputation: 41

You can try this xpath with single quotations,

//div[@class=‘react-bs-container-body’]//tbody/tr[td[@tabindex='7']]

Also, you can try with the below xpath as well

//div[@class=‘react-bs-container-body’]//tbody/tr[td[7]]

Upvotes: 0

Related Questions