WebDriver'对象没有属性'find_element_by_id'

问题描述 投票:0回答:1

我正在运行 tiktok scrapper,但收到此错误。我该如何解决它?

C:\Users\edit\Downloads\Compressed\shot\shorts\tiktokscraper\downloader.py:31: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
  driver = webdriver.Chrome(executable_path=driver_path, options=option)

DevTools listening on ws://127.0.0.1:50049/devtools/browser/85f1588d-2d26-4cbf-bd8d-a992dc20e370
[8724:8648:0711/140535.825:ERROR:device_event_log_impl.cc(214)] [14:05:35.836] Bluetooth: bluetooth_adapter_winrt.cc:1074 Getting Default Adapter
failed.
Traceback (most recent call last):
  File "C:\Users\edit\Downloads\Compressed\shot\shorts\tiktokscraper\downloader.py", line 98, in <module>
    download(tiktok_list)
  File "C:\Users\edit\Downloads\Compressed\shot\shorts\tiktokscraper\downloader.py", line 47, in download
    url_field = driver.find_element_by_id('url')
AttributeError: 'WebDriver' object has no attribute 'find_element_by_id'
python google-chrome selenium-chromedriver webdriver
1个回答
3
投票

Selenium 版本 4.3.0 不再支持使用 driver.find_element_by_* 尝试 driver.find_element(By.ID, url)。

© www.soinside.com 2019 - 2024. All rights reserved.