Open GoogleCodeExporter opened 9 years ago
This is where Selenium is powerful as it's possible to use CSS or an XPath to
locate an element.
Using an XPath (Selenium 2):
title = wd.findElementByXPath("//input[@id='FormQual']/div[@class='column
sixtythree
right']/div[@class='inner']/table[2]/tbody/tr[3]/td[8]").getAttribute("title")
Using an XPath (Selenium 1) :
title = wd.getAttribute("xpath=/input[@id='FormQual']/div[@class='column
sixtythree right']/div[@class='inner']/table[2]/tbody/tr[3]/td[8]@title")
Using CSS (Selenium 2):
title = wd.findElementByCssSelector("input#FormQual >
div.column.sixtythree.right > div.inner > table:nth-child(2) > tbody >
tr:nth-child(3) > td:nth-child(8)").getAttribute("title")
Using CSS (Selenium 1):
title = wd.getAttribute("css=input#FormQual > div.column.sixtythree.right >
div.inner > table:nth-child(2) > tbody > tr:nth-child(3) >
td:nth-child(8)@title")
Locators may require some adjustments. You can easily get the Css locator in
Firefox using the inspector:
- Right click on the element and click on inspect element
- Right click one the node and click "Copy Unique Selector"
Original comment by florentbr
on 16 Apr 2014 at 12:20
Thanks a lot, it is working well :)
Original comment by religie...@gmail.com
on 16 Apr 2014 at 12:57
Original comment by florentbr
on 8 Sep 2014 at 5:40
Original issue reported on code.google.com by
religie...@gmail.com
on 15 Apr 2014 at 8:28Attachments: