I'm trying to get the value from this HTML tag automatically:
<span data-testid="TemperatureValue" class="CurrentConditions--tempValue--1RYJJ">84°</span>
Also, should I be using the XPath or the full Xpath for my find_element_by_xpath() variable?
I'm trying to get the value from this HTML tag automatically:
<span data-testid="TemperatureValue" class="CurrentConditions--tempValue--1RYJJ">84°</span>
Also, should I be using the XPath or the full Xpath for my find_element_by_xpath() variable?
Try with this
degree = driver.find_element_by_xpath("//*[@data-testid='TemperatureValue']").text
print(degree)
Use
driver.find_element_by_css_selector('span[data-testid="TemperatureValue"]').text
Store this in a variable and print it