pythonseleniumselenium-firefoxdriverrequest-timed-out

selenium TimeoutException: Message: python


I have the following code, and trying to connect to itunesconnect using selenium

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait

driver = webdriver.Firefox()

driver.get("https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa")
element = WebDriverWait(driver, 20).until(lambda driver : driver.find_element_by_id('appleId'))

But i was getting *** TimeoutException: Message: as below

*** TimeoutException: Message:
Stacktrace:
    at FirefoxDriver.prototype.findElementInternal_ (file:///var/folders/x1/1bwt313j0qvgdh5pfzpbpvcw0000gn/T/tmp27vpUf/extensions/fxdriver@googlecode.com/components/driver-component.js:10770)
    at FirefoxDriver.prototype.findElement (file:///var/folders/x1/1bwt313j0qvgdh5pfzpbpvcw0000gn/T/tmp27vpUf/extensions/fxdriver@googlecode.com/components/driver-component.js:10779)
    at DelayedCommand.prototype.executeInternal_/h (file:///var/folders/x1/1bwt313j0qvgdh5pfzpbpvcw0000gn/T/tmp27vpUf/extensions/fxdriver@googlecode.com/components/command-processor.js:12661)
    at DelayedCommand.prototype.executeInternal_ (file:///var/folders/x1/1bwt313j0qvgdh5pfzpbpvcw0000gn/T/tmp27vpUf/extensions/fxdriver@googlecode.com/components/command-processor.js:12666)
    at DelayedCommand.prototype.execute/< (file:///var/folders/x1/1bwt313j0qvgdh5pfzpbpvcw0000gn/T/tmp27vpUf/extensions/fxdriver@googlecode.com/components/command-processor.js:12608)

Any idea of what's going wrong ?


Solution

  • The element is inside iframe, you need to switch to it first

    driver.switch_to_frame('authFrame') # by frame id, can also be name or WebElement
    element = WebDriverWait(driver, 20).until(lambda driver : driver.find_element_by_id('appleId'))
    

    And to switch back

    driver.switch_to_default_content()