|
测试环境: Firefox 48.0.2 + selenium3.3.1+python3.6.1
# coding=utf-8
from selenium import webdriver
import time
driver=webdriver.Firefox()
driver.get("https://mail.qq.com/")
driver.switch_to.frame("login_frame")
driver.find_element_by_id("switcher_plogin").click()
driver.find_element_by_id("u").clear()
driver.find_element_by_id("u").send_keys("807673920")
driver.find_element_by_id("p").clear()
driver.find_element_by_id("p").send_keys("password")
driver.find_element_by_id("login_button").click()
#time.sleep(3)
# driver.switch_to.frame("actionFrame")
driver.find_element_by_id("composebtn").click()
运行到最后一行就提示找不到composebtn这个元素,考虑到有可能是表单切换,我用最笨的方法把所有iframe 的id都找出来(osslog_iframe,mainFrame,leftFrame,actionFrame),试着切换到这几个frame还是提示找不到元素,同时提示找不到frame.
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [id="actionFrame"]
selenium.common.exceptions.NoSuchFrameException: Message: actionFrame
怕登录之后load时间不够长,我设置了等待时间,还是提示找不到元素 :
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [id="actionFrame"]
During handling of the above exception, another exception occurred:
selenium.common.exceptions.WebDriverException: Message: can't access dead object
有没有大神帮忙看看到底是什么问题呢,不胜感激!!!
|
|