import osfrom selenium import webdriverimport datetimeimport timefrom seleniumwebdriverchromeoptions import Optionsoptions = Optionsoptionsdebugger_address = 1270019222chrome_driver = CProgram Files x
可以使用以下代码替换原有的 webdriver.Chrome() 语句:
from selenium.webdriver.chrome.service import Service
chrome_driver = "C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe" service = Service(executable_path=chrome_driver) driver = webdriver.Chrome(service=service, options=options)
这样就可以避免 DeprecationWarning 警告了。
原文地址: https://www.cveoy.top/t/topic/g5U5 著作权归作者所有。请勿转载和采集!