This I know is a very simple question. I'm quite sick and trying to finish up this asap and my brain just doesn't seem to be working right.
How to extract 1 from this code. Please help me on this
The HTML code is as follows:-
<font size="5">
<p id="showscripts">1</p>
</font>
CodePudding user response:
With Selenium and XPath locator it will be something like this:
value = driver.find_elements_by_xpath("//*[name()=`font` and @size='5']/p[@id='showscripts']").text
With addition of Expected Conditions explicit wait it will be:
value = wait.until(EC.visibility_of_element_located((By.XPATH, "//*[name()=`font` and @size='5']/p[@id='showscripts']"))).text
CodePudding user response:
text = driver.find_element_by_id("showscripts").text
This must work, try it.