selecting element in python selenium

后端 未结 4 1067
遇见更好的自我
遇见更好的自我 2021-01-23 21:27

I\'m trying to log onto a webpage with python selenium. I\'ve found an element and it is enabled, but when I try to send_keys() to it I get an error. The main thing (I think)

4条回答
  •  忘掉有多难
    2021-01-23 21:56

    I had similar issue, selenium was not able to focus and open the login modal. Instead it was focusing on the next element. This was the locator I was using:

    elem = browser.find_element_by_xpath("//nav[2]/ul/li[3]/a").click()
    

    I just changed [3] with [2] and it was able to locate the element and open the modal:

    elem = browser.find_element_by_xpath("//nav[2]/ul/li[2]/a").click()
    

提交回复
热议问题