![](/img/trans.png)
[英]how to click on different links of directory listing in a web page using selenium web-driver python
[英]run 3 variables in for loop python selenium web-driver to print all data including links
我嘗試使用 selenium Web 驅動程序中的 Python 在 for 循環中獲取當前價格、公司名稱和公司(鏈接文本)鏈接。 這是我的 URL http://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)
它顯示錯誤:
AttributeError: 'list' object has no attribute 'link'
請幫我打印費率、公司名稱和鏈接。
你把.
在 zip 內部,
以下是您如何修復for name,rate,links in zip(company,price,link):
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.