Tuesday, 15 January 2013

how to find xpath, class name of elements python selenium -



how to find xpath, class name of elements python selenium -

my code is:

driver.get("http://www.thegoodguys.com.au/buyonline/searchdisplay?pagesize=16&beginindex=0&searchsource=q&stype=simplesearch&resultcatentrytype=2&showresultspage=true&pageview=image&searchterm=laptops") link=(); linkprice=(); price=(); productname=[]; site='harvey norman' link=driver.find_elements_by_class_name("photo") linkprice=driver.find_elements_by_class_name("product-title") price=driver.find_elements_by_xpath("//div[@class='purchase']/span/span")

i not sure whether supplied xpath , class_name correct. 1 verify them , please allow me know how find them

in firefox can utilize developer tools or firebug check html classes , element ids. next link in question can find class called photo linkprice , cost should utilize other classes.

try:

price=driver.find_elements_by_class_name("price") linkprice=driver.find_elements_by_class_name("addtocart")

which gives me:

price[0].text u'$496' linkprice[0].text u'add cart'

python selenium xpath classname

No comments:

Post a Comment