Chrome WebDriver'对象没有属性'find_element_by_id'

fnx2tebb  于 2023-04-27  发布在  Go
关注(0)|答案(1)|浏览(313)

我正在运行一个tiktok scraper,我得到了这个错误。我该如何修复它?

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'
mcvgt66p

mcvgt66p1#

Selenium版本4.3.0不再支持使用driver.find_element_by_*。您应该改用driver.find_element(By.ID, url)

相关问题