0

I have checked far and wide for a fix for this. But to no avail. Nothing seems to work. I am trying to locate a Username and Password box to enter in the information. But it comes up with the error

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="userName"]"}

I have tried to find using id but still no luck.
Any ideas?

username_box = bot.driver.find_element_by_xpath('//*[@id="userName"]')

This is the inspect element

<input class="userNameField" maxlength="255" id="userName" name="userName" type="text">
  • Did you try explicit wait – PDHide Feb 3 at 17:05
  • else try if its inside a different frame – PDHide Feb 3 at 17:06
  • I am using -i in the command line, so elements loading are not a problem. I have been on the page for 5 minutes now – John Jowett Feb 3 at 17:07
  • It is interactive, so I entered in the command and am sure that the box is fully loaded. So using a wait would not be required. Unless I am misunderstanding what an explicit wait is – John Jowett Feb 3 at 17:12
  • freekigames.com/educational-trivia That is the link to the website. Just click the orange Login/Sign Up box. You cannot inspect the box, but you can inspect the word and find the box easily – John Jowett Feb 3 at 17:14
1
bot.driver.switch_to.frame(bot.driver.find_element_by_xpath('//*[@id="jPopFrame_content"]'))
| improve this answer | |
  • 2
    Hi John, is this what worked for you? If so, it would be good to add a small amount of info about how you arrived at it, just to help future readers who might have a slightly different but not quite different enough to ask a new question kind of issue. Thanks! – corsiKa Feb 3 at 22:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.