51Testing软件测试论坛

标题: selenium报错,求助!! [打印本页]

作者: leonlh    时间: 2016-1-6 17:27
标题: selenium报错,求助!!
本帖最后由 leonlh 于 2016-1-6 17:29 编辑

近期刚开始学习selenium+python,简单的百度首页登录,遇到一问题不得其解,求大神帮忙。
#coding=utf-8
from selenium import webdriver
import time

browser = webdriver.Firefox()
browser.get("http://www.baidu.com/")
browser.find_element_by_name("tj_login").click()


信息提示:"D:\Python27\python.exe" -u "D:\Program Files (x86)\UliPad\baidu_login.py"
Traceback (most recent call last):
  File "D:\Program Files (x86)\UliPad\baidu_login.py", line 9, in <module>
    browser.find_element_by_name("tj_login").click()
  File "D:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 75, in click
    self._execute(Command.CLICK_ELEMENT)
  File "D:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 454, in _execute
    return self._parent.execute(command, params)
  File "D:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 201, in execute
    self.error_handler.check_response(response)
  File "D:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 181, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotVisibleException: Message: Element is not currently visible and so may not be interacted with
Stacktrace:
    at fxdriver.preconditions.visible (file:///c:/users/admini~1/appdata/local/temp/tmpbudvzx/extensions/fxdriver@googlecode.com/components/command-processor.js:9981)
    at DelayedCommand.prototype.checkPreconditions_ (file:///c:/users/admini~1/appdata/local/temp/tmpbudvzx/extensions/fxdriver@googlecode.com/components/command-processor.js:12517)
    at DelayedCommand.prototype.executeInternal_/h (file:///c:/users/admini~1/appdata/local/temp/tmpbudvzx/extensions/fxdriver@googlecode.com/components/command-processor.js:12534)
    at DelayedCommand.prototype.executeInternal_ (file:///c:/users/admini~1/appdata/local/temp/tmpbudvzx/extensions/fxdriver@googlecode.com/components/command-processor.js:12539)
    at DelayedCommand.prototype.execute/< (file:///c:/users/admini~1/appdata/local/temp/tmpbudvzx/extensions/fxdriver@googlecode.com/components/command-processor.js:12481)
作者: leonlh    时间: 2016-1-7 09:08
没人啊?自顶




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2