ElementNotVisibleException : Selenium Python

后端 未结 1 1147
伪装坚强ぢ
伪装坚强ぢ 2020-11-28 16:37

I have checked all previous similar issues, they are not applicable to my case.

   try:
      element = wait.until(
      EC.presence_of_element_located((By.         


        
相关标签:
1条回答
  • 2020-11-28 17:19

    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()
      
    0 讨论(0)
提交回复
热议问题