问题
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