首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在kali linux中使用undetected_chromedriver.v2

如何在kali linux中使用undetected_chromedriver.v2
EN

Stack Overflow用户
提问于 2021-12-02 05:51:41
回答 1查看 196关注 0票数 0

如何在kali linux中使用undetected_chromedriver.v2

代码语言:javascript
运行
复制
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) 
EN

回答 1

Stack Overflow用户

发布于 2021-12-02 23:38:29

如果您使用的是selenium4,则使用时会出现以下错误:

代码语言:javascript
运行
复制
TypeError: __init__() got an unexpected keyword argument 'service'

根据状态进行内联:

2021年7月:目前正忙于为未检测到的chromedriver实现selenium 4

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

代码语言:javascript
运行
复制
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')

参考文献

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70194755

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档