M
M
MelsikProgger2021-03-13 12:45:47
Python
MelsikProgger, 2021-03-13 12:45:47

How to parse an element only if it is visible?

Hello. I am using python and selenium. I have a site. And I need to parse an element only if that element is visible

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sanya Hihi Haha, 2021-03-13
@ValarMayar

Stupidly the first answer on the stack

browser.find_element_by_css_selector(".reply-button").click()

# Wait for initialize, in seconds
wait = WebDriverWait(browser, 10)

email = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, '.anonemail'))).get_attribute("value")
print(email)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question