No Such Element (Selenium)

  • 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">

  • bot.driver.switch_to.frame(bot.driver.find_element_by_xpath('//*[@id="jPopFrame_content"]'))

Suggested Topics