还是运行不起来,报找不到元素,请看看是什么原因呢
以下为代码:
driver.get("https://www.imooc.com/user/setprofile")
time.sleep(5)
driver.find_element_by_id("upload").send_keys("D:\\1.jpg")
time.sleep(4)
以下为报错日志:
C:\Users\Administrator\PycharmProjects\we1\venv\Scripts\python.exe C:/Users/Administrator/PycharmProjects/we1/select_element.py
Traceback (most recent call last):
File "C:/Users/Administrator/PycharmProjects/we1/select_element.py", line 52, in <module>
ww=driver.find_element_by_id("upload")
File "C:\Users\Administrator\PycharmProjects\we1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 360, in find_element_by_id
return self.find_element(by=By.ID, value=id_)
File "C:\Users\Administrator\PycharmProjects\we1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 978, in find_element
'value': value})['value']
File "C:\Users\Administrator\PycharmProjects\we1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Administrator\PycharmProjects\we1\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element
(Session info: chrome=52.0.2743.82)
(Driver info: chromedriver=2.7.236900,platform=Windows NT 6.3 x86_64)