1. Question:
When learning the selenium part of the crawler, AttributeError appears: ‘WebDriver’ object has no attribute ‘find_ element_ by_ Id ‘problem.
2. Reasons:
Because of version iteration, find_element_by_id method is not supported in the new version of selenium.
3. Solution:
Modify button = browser.find_element_by_id(‘su’) to the following codes:
button = browser.find_element(By.ID,'su')
Add the following code at the front of the code page,
from selenium.webdriver.common.by import By
Read More:
- [Solved] Python Selenium Error: AttributeError: ‘WebDriver‘ object has no attribute ‘find_element_by_xpath‘
- [Solved] AttributeError: module ‘selenium.webdriver‘ has no attribute ‘Chrome‘
- [Solved] AttributeError: ‘Manager‘ object has no attribute ‘get_by_natural_key‘
- [Solved] AttributeError: ‘PngImageFile‘ object has no attribute ‘imshow‘
- [Solved] vpython: AttributeError: ‘box‘ object has no attribute ‘idx‘
- Python+Selenium Error: AttributeError: ‘WebDriver‘ NameError: name ‘By‘ is not defined
- [Solved] AttributeError: ‘NoneType‘ object has no attribute ‘append‘
- [Solved] AttributeError: ‘HTMLWriter‘ object has no attribute ‘_temp_names‘
- [Solved] AttributeError: ‘DataParallel‘ object has no attribute ‘save‘
- AttributeError: DatetimeProperties object has no attribute
- [Solved] AttributeError: ‘str‘ object has no attribute ‘decode‘
- [Solved] AttributeError: ‘NoneType‘ object has no attribute ‘astype‘
- [Solved] AttributeError: DataFrame object has no attribute’xxx’
- [Solved] AttributeError: ‘DataFrame‘ object has no attribute ‘tolist‘
- [Solved] AttributeError WriteOnlyWorksheet object has no attribute cell
- [Solved] AttributeError: ‘DataFrame‘ object has no attribute ‘map‘
- [Solved] Networkx Error: Attributeerror: ‘graph’ object has no attribute ‘node’
- [Modified] AttributeError: ‘socket‘ object has no attribute ‘ioctl‘ python linux
- [Solved] Add-apt-repository Command Error: AttributeError: ‘Thread‘ object has no attribute ‘isAlive‘
- [Solved] AttributeError: ‘str‘ object has no attribute ‘decode‘