0

How to get particular row & column values in web table using python web driver. I have been trying but i can't get it. please any one give me idea for how we get row & column values. Here my codes

start="//*[@id='p1']/div/table/tbody/tr["
end= str(i)+ "]/td[1]/a"
row1=driver.find_element_by_xpath(start + end)
print row1.text

1 Answer 1

2

Try this,its working fine on my system:

driver = webdriver.Firefox()
driver.get("http://www.flipkart.com/programming-python-4th-e-d/p/itmczzj4gpfrr6bs?pid=9789350232873&icmpid=reco_pp_hSame_book_1")
data=[]
for tr in driver.find_elements_by_xpath('//table[@class="mprod-similar-prod-table"]//tr'):
  tds=tr.find_elements_by_tag_name('td')
  if tds: 
    data= [td.text for td in tds]
print "3730" in data[2] #or whatever is the current price
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.