TA的每日心情 | 慵懒 2018-1-23 11:34 |
---|
签到天数: 47 天 连续签到: 1 天 [LV.5]测试团长
|
代码如下
#coding=utf-8
from selenium import webdriver
import time
driver = webdriver.Chrome()
driver.get("http://10.0.12.211:8081/p2p/jsp/login.jsp")
#driver.find_element_by_id("login_anchor").click()
driver.find_element_by_id("j_username").clear()
driver.find_element_by_id("j_username").send_keys("test01")
time.sleep(5)
driver.find_element_by_id("x_password").clear()
driver.find_element_by_id("x_password").send_keys("12345678")
运行报错如下:
Traceback (most recent call last):
File "C:/Users/ebt/PycharmProjects/EBT/test.py", line 12, in <module>
driver.find_element_by_id("x_password").send_keys("12345678")
File "D:\Python27\lib\site-packages\selenium-2.45.0-py2.7.egg\selenium\webdriver\remote\webelement.py", line 318, in send_keys
self._execute(Command.SEND_KEYS_TO_ELEMENT, {'value': typing})
File "D:\Python27\lib\site-packages\selenium-2.45.0-py2.7.egg\selenium\webdriver\remote\webelement.py", line 402, in _execute
return self._parent.execute(command, params)
File "D:\Python27\lib\site-packages\selenium-2.45.0-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 175, in execute
self.error_handler.check_response(response)
File "D:\Python27\lib\site-packages\selenium-2.45.0-py2.7.egg\selenium\webdriver\remote\errorhandler.py", line 166, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible
(Session info: chrome=53.0.2785.101)
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64)
被测页面如下:
|
|