Trying to use xpath in order to select a text on desktop web browser



  • This is the error I am getting below:

    selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="select-input-a7c294b6-e242-44b4-b153-67f6f42ecf77-opt-0"]"}

    I am adding sleep(10) testing to see if the page isn't loading but this isn't the case.

    This is what I am using:

    self.driver_web.find_element_by_xpath('//*[@id="select-input-a7c294b6-e242-44b4-b153-67f6f42ecf77-opt-0"]').click()
    

    enter image description here



  • Class and ID are auto-generating so I think that you should change xpath to contain (text(),'text of element') or anything that was fixed.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2