selenium常见问题(1)
Traceback (most recent call last):
File “D:/selenium/xuehu.py”, line 23, in <module>
text= browser.find_element_by_class_name(“user-name”).text
File “C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 426, in find_element_by_class_name
return self.find_element(by=By.CLASS_NAME, value=name)
File “C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 784, in find_element
‘value’: value})[‘value’]
File “C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 249, in execute
self.error_handler.check_response(response)
File “C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py”, line 193, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {“method”:”class name”,”selector”:”user-name”}
(Session info: chrome=51.0.2704.106)
(Driver info: chromedriver=2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129),platform=Windows NT 6.3.9600 x86_64)