Skip to content Skip to sidebar Skip to footer

ElementNotVisibleException: Message: Element Not Visible - Python3 Selenium

I have been tasked with writing a parser to click a href link, that looks like a button, on a website and I am having some issues. Here's the html: https://pastebin.com/HDKLXpdJ He

Solution 1:

There are a couple issues.

  1. You are waiting for presence of the element. Presence just means that the element is in the DOM, not that it's visible or clickable. If you are going to wait and click an element, wait for it to be clickable. If you are going to wait to send_keys() or get the text from an element, wait for it to be visible. The are some uses for presence but I don't use it often. Having said that...

  2. There are two elements that match your locator, id=reply-panel-reveal-btn. The first one that match just happens to be invisible. With XPath we can create a locator that finds the second element, wait for it to be clickable, and then click it.

    element = WebDriverWait(driver, 20).until(
        EC.element_to_be_clickable((By.XPATH, "(//a[@id='reply-panel-reveal-btn'])[2]")));
    element.click()
    

Solution 2:


Post a Comment for "ElementNotVisibleException: Message: Element Not Visible - Python3 Selenium"