使用selenium进行获取一些数据时,运行时一直报警告:‘DeprecationWarning: use options instead of chrome_options driver = webdriver.Chrome(path, chrome_options=option)’
虽然不是个错误,但还是解决一下,可能是参数进行了替换吧,将chrome_options变成options就行了
如下:
options = webdriver.ChromeOptions() options.add_experimental_option("excludeSwitches", ["enable-automation"]) options.add_experimental_option('useAutomationExtension', False) options.add_argument('lang=zh-CN,zh,zh-TW,en-US,en') options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36') options.add_argument("disable-blink-features=AutomationControlled") # 就是这一行告诉chrome去掉了webdriver痕迹 driver = webdriver.Chrome(options=options)