硒超时异常:消息:python

selenium TimeoutException: Message: python

我有以下代码,并尝试使用 selenium 连接到 itunesconnect

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'))

但我得到 *** TimeoutException: Message: 如下

*** 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)

知道出了什么问题吗?

元素在iframe里面,需要先切换到

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'))

然后切换回去

driver.switch_to_default_content()