![](/img/trans.png)
[英]How to get 'n' random points between start and end coordinates in python?
[英]How do I get the value between the start and end tag Python Selenium?
我正在嘗試自動從此 HTML 標記中獲取值:
<span data-testid="TemperatureValue" class="CurrentConditions--tempValue--1RYJJ">84°</span>
另外,我應該為 find_element_by_xpath() 變量使用 XPath 還是完整的 Xpath?
試試這個
degree = driver.find_element_by_xpath("//*[@data-testid='TemperatureValue']").text
print(degree)
采用
driver.find_element_by_css_selector('span[data-testid="TemperatureValue"]').text
將其存儲在變量中並打印
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.