TA的每日心情 | 难过 2017-8-17 13:45 |
---|
签到天数: 21 天 连续签到: 1 天 [LV.4]测试营长
|
# -*-encoding:utf-8 -*-
from selenium import webdriver
chromedriver='C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe'
browser=webdriver.Chrome(chromedriver)
browser.get("http://120.26.50.11:8088/publish/crm/login.html")
browser.find_element_by_id("username").send_keys("admin")
这是我的代码,输入admin值就不行,为什么?这是报错信息:Traceback (most recent call last): File "E:/Users/Administrator/PycharmProjects/练习/练习1.py", line 10, in <module> browser.find_element_by_id("username").send_keys("admin") File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 285, in find_element_by_id return self.find_element(by=By.ID, value=id_) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 787, in find_element 'value': value})['value'] File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in execute self.error_handler.check_response(response) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response raise exception_class(message, screen, stacktrace)selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"id","selector":"username"} (Session info: chrome=51.0.2704.106) (Driver info: chromedriver=2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129),platform=Windows NT 10.0.14393 x86_64)
|
|