ElementNotVisibleException : Selenium Python

A few words about the solution:

  1. Expected conditions with clause presence_of_element_located() relates to an expectation for checking that an element is present on the DOM of a page. This does not necessarily mean that the element is visible. The locator used to find the element returns the WebElement once it is located. Hence we have to change the clause from presence_of_element_located() to visibility_of_element_located() which relates to an expectation for checking that an element, known to be present on the DOM of a page, is visible. Visibility means that the element is not only displayed but also has a height and width that is greater than 0. element is the WebElement returns the (same) WebElement once it is visible.
  2. Moving forward you have tried to invoke click() method for the WebElement. So instead of presence_of_element_located() we will use the element_to_be_clickable() clause.
  3. Here is your own code with minor changes :

    try:
        element = wait.until(EC.element_to_be_clickable((By.XPATH, "//*[@id='_ariaId_73.folder'] | //*[@id='_ariaId_133.folder']")))
    except: 
        print "403 : Monitoring Not Found"
    element.click()
    

Leave a Comment