|
哪位大神有空,帮忙看看问题出在哪里,谢谢啦
定位class=u-input box的div也没有成功
代码:
#!usr/bin/python
# -*- coding:utf-8 -*-
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('https://mail.163.com/')
# 默认显示二维码登录,点右上角切换到用户名密码登录
driver.find_element_by_id("lbNormal").click()
# 通过Xpath定位到输入框
driver.find_element_by_xpath("//input[@name='email']")
input('Press any key to close firefox')
driver.quit()
报错信息:
C:\ProgramData\Anaconda3\python.exe D:/PythonScript/Project1/venv/Scripts/lianxi.py
Traceback (most recent call last):
File "D:/PythonScript/Project1/venv/Scripts/lianxi.py", line 10, in <module>
driver.find_element_by_xpath("//input[@name='email']")
File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 978, in find_element
'value': value})['value']
File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //input[@name='email']
|
|