标签:代码 res element lob div ble get att xpath
HTML源代码:
<div class="res-status" data-fortune="5" data-selfsos="" data-id="39052">
已定位到div,有3个值,想得到data-id的值。
driver.find_element_by_xpath("//*[@id=‘lobby-left-container‘]/div[2]/div/table/tbody/tr[1]/td[2]/div")
a = driver.find_element_by_xpath("//*[@id=‘lobby-left-container‘]/div[2]/div/table/tbody/tr[1]/td[2]/div").get_attribute("data-id")
print(a)
标签:代码 res element lob div ble get att xpath
原文地址:https://www.cnblogs.com/lizhe860/p/8340545.html