Reputation: 9
I have a JSP page populated by javascript resulting in a typical table element cascade <table><tbody><tr><td>
. After population I see the text I want using
getTable("tableLister.listTable.1.1")
The table also has a class=clsDisplayTableBody
.
I want to click the check box in column 0 for the row of interest. However, all of these tests fail
isElementPresent("//*[text()="+cellContents+"]/../td[0]"))
isElementPresent("//table[@class='clsDisplayTableBody']//tr[1]/td[0]"))
isElementPresent("css='clsDisplayTableBody' tr:nth-child(1) td:nth-child(0)"))
isElementPresent("//xpath=id('tableLister.listTable')/descendant::tr[1]/descendant::td[0]"))
isElementPresent("//table[@id='tableLister.listTable']//tbody/tr[1]/td[0]"))
isElementPresent("//table[@id='tableLister.listTable']//tr[1]/td[0]"))
Is there anything else I could try?
Upvotes: 0
Views: 644
Reputation: 243539
I want to click the check box in column 0 for the row of interest. However, all of these tests fail
isElementPresent("//*[text()="+cellContents+"]/../td[0]"))
isElementPresent("//table[@class='clsDisplayTableBody']//tr[1]/td[0]"))
isElementPresent("css='clsDisplayTableBody' tr:nth-child(1) td:nth-child(0)"))
isElementPresent("//xpath=id('tableLister.listTable')/descendant::tr[1]/descendant::td[0]"))
isElementPresent("//table[@id='tableLister.listTable']//tbody/tr[1]/td[0]"))
isElementPresent("//table[@id='tableLister.listTable']//tr[1]/td[0]"))
One obvious error is using 0
as index. XPath is 1-based.
You may be closer to obtaining the wanted result after you increase the indexes by 1.
Upvotes: 2