Reputation: 25
I try to get the current price, company name, and company (link-text) links in for loop using Python in selenium web-driver. this is my URLhttp://demo.guru99.com/test/web-table-element.php
company = driver.find_elements_by_xpath("//*[@id='leftcontainer']/table/tbody/tr/td/a")
price = driver.find_elements_by_xpath("//*[@id='leftcontainer']/table/tbody/tr/td[4]")
link = driver.find_elements_by_xpath("//*[@id='leftcontainer']/table/tbody/tr/td/a")
for name,rate,links in zip(company,price.link):
names = name.text
rates = rate.text
url = links.get_attribute("href")
if float(rates) <= 500:
print(names,rates,url)
and it's showing error:
AttributeError: 'list' object has no attribute 'link'
please help me to print rates, company names, and links.
Upvotes: 0
Views: 72
Reputation: 593
You put .
insead of ,
inside the zip, here is how you fix it for name,rate,links in zip(company,price,link):
Upvotes: 1