Get link from attribute in actual row in selenium Python

你。 提交于 2020-08-20 10:34:19

问题


I fetch the data from the web-table but the link was not an actual row attribute link. It was a 2 rows before the attribute link.

Here is my code:

stack = driver.find_elements_by_xpath(".//span[@data-bind = 'text: $salableQuantityData.qty']")
quant = driver.find_elements_by_xpath("//*[@class='admin__data-grid-wrap']/table/tbody/tr/td[7]/div")
link = driver.find_elements_by_xpath("//*[@class='admin__data-grid-wrap']/table/tbody/tr/td[15]/a")
#looping all 3 variables
for stuck,quantity,links in zip(stack,quant,link):
  stick = stuck.text
  quanty = quantity.text
  url = links.get_attribute("href")
  quntite = int(float(quanty))
  stock = int(stick)
  if stock < 0:
    stocks = abs(stock)
    print(quntite,stocks,url)

来源:https://stackoverflow.com/questions/62575960/get-link-from-attribute-in-actual-row-in-selenium-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!