Issue
I want to get the Text of a Element with Selenium.
Element:
<p class="sc-168cvuh-1 cNxwvb"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="circle" class="svg-inline--fa fa-circle fa-w-16 fa-fw sc-168cvuh-2 frUsNu" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" _css="[object Object],[object Object]"><path fill="currentColor" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"></path></svg> running</p>
I wanna get the "running" from the Element.
How to do that?
Solution
Does this work ?
wait = WebDriverWait(driver, 10)
desired_text = wait.until(EC.visibility_of_element_located((By.XPATH, "//p[contains(@class, 'sc-')]"))).text
print(desired_text)
Imports :
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
Answered By - cruisepandey
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.