0

如何在 kali linux 中使用 undetected_chromedriver.v2

import undetected_chromedriver.v2 as uc
options = uc.ChromeOptions()

# setting profile
options.user_data_dir = "c:\\temp\\profile"

# another way to set profile is the below (which takes precedence if both variants are used
options.add_argument('--user-data-dir=c:\\temp\\profile2')

# just some options passing in to skip annoying popups
options.add_argument('--no-first-run --no-service-autorun --password-store=basic')
bw = uc.Chrome(options=options, version_main=92) 
4

1 回答 1

0

如果您使用的是 ,那么使用undetected_chromedriver.v2您将面临以下错误:

TypeError: __init__() got an unexpected keyword argument 'service'

根据状态是内联的:

2021 年 7 月:目前正忙于为 undetected-chromedriver 实施 selenium 4


但是,对于,您仍然可以使用undetected_chromedriver v1,如下所示:

import undetected_chromedriver as uc
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service

options = uc.ChromeOptions() 
options.add_argument("start-maximized")
s = Service('C:\\BrowserDrivers\\chromedriver.exe')
driver = uc.Chrome(service=s, options=options)
driver.get('https://datadome.co/customers-stories/toppreise-ends-web-scraping-and-content-theft-with-datadome/')
driver.save_screenshot('datadome_undetected_webddriver.png')

参考

您可以在以下位置找到一些相关的详细讨论:

于 2021-12-02T23:38:28.627 回答