如何在kali-linux 中使用未检测的chromediver.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)
如果您使用selenium4,则使用未检测到的chromedriver.v2,您将面临以下错误:
TypeError: __init__() got an unexpected keyword argument 'service'
根据状态内联:
2021年7月:目前正忙于为未检测到的彩色打印机实施硒4
但是,使用硒4,您仍然可以使用未检测到的显色器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')
参考文献
您可以在中找到一些相关的详细讨论
- 未检测到Chromedriver未正确加载
- 硒的蒸发检测自动化