Reputation: 1857
I have an integration test. It uses Selenium, from Java. I would like to click on a specific link, which has no ID. All I know about it is that it is in a specific cell in a specific table. The table has an ID.
How can I click on that element using DefaultSelenium
?
I tried
defaultselenium.click("th.tblHeader:nth-child(14) > a:nth-child(1)");
because Firefox said that it's the XPath of the element, and I also tried
defaultselenium.click("#tableId > thead:nth-child(1) > tr > th.tblHeader:nth-child(14) > a:nth-child(1)");
because I don't use XPath very often and I had no idea what I was doing, but I thought that having a unique ID in the equation may help. Both of them give me "ERROR: Element ... not found" messages.
Upvotes: 1
Views: 185
Reputation: 3037
That's not XPath, it's CSS. Vanilla Firefox isn't helpful for extracting XPath from a page, but there are plugins available. Alternatively, Chrome will give you the XPath.
Upvotes: 1