当前位置: 首页 > 知识库问答 >
问题:

未检测到Chromedriver未正确加载

涂羽
2023-03-14

我试图使用一个带有selenium的无头chrome浏览器,它也绕过了机器人检测测试,目前使用以下项目https://github.com/ultrafunkamsterdam/undetected-chromedriver每次我试图实现代码时,它都不能识别驱动程序。以下是您了解的链接

这是代码

#
# UNDETECTED chromedriver (headless,even)
#
import undetected_chromedriver as uc
options = uc.ChromeOptions()
options.headless=True
options.add_argument('--headless')
chrome = uc.Chrome(options=options)
chrome.get('https://datadome.co/customers-stories/toppreise-ends-web-scraping-and-content-theft-with-datadome/')
chrome.save_screenshot('datadome_undetected_webddriver.png')

好吧,当我运行程序时,我在终端中得到以下内容

DevTools listening on ws://127.0.0.1:55903/devtools/browser/ef3a54cf-35b9-400f-972c-2b54ca227eb8
[0102/000855.199:INFO:CONSOLE(2)] "JQMIGRATE: Migrate is installed, version 1.4.1", source: https://datadome.co/wp-content/cache/busting/1/wp-includes/js/jquery/jquery-migrate.min-1.4.1.js (2)
[0102/000856.946:INFO:CONSOLE(1)] "Messaging child iframes", source: https://track.gaconnector.com/gaconnector.js (1)
[0102/000856.946:INFO:CONSOLE(1)] "https://track.gaconnector.com/track_pageview?gaconnector_id=ddade4fc-93d0-20a3-79fa-39648d8e6629&account_id=6dd3433635353fd00f486550bcd5b157&referer=&GA_Client_ID=183291439.1609510136&page_url=https%3A%2F%2Fdatadome.co%2Fcustomers-stories%2Ftoppreise-ends-web-scraping-and-content-theft-with-datadome%2F&gclid=&utm_campaign=&utm_term=&utm_content=&utm_source=&utm_medium=", source: https://track.gaconnector.com/gaconnector.js (1)
PS D:\Programming\Python> [0102/000902.158:INFO:CONSOLE(0)] "The resource https://js.driftt.com/core/assets/js/runtime~main.a73a2727.js was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://js.driftt.com/core?embedId=2rce7xnshapc&forceShow=false&skipCampaigns=false&sessionId=98163ad1-ed91-459e-9473-3f8861aa717e&sessionStarted=1609510138&campaignRefreshToken=107a7fd5-edb4-499b-9f39-5306c189cdb6&pageLoadStartTime=1609510135613 (0)
[0102/000902.272:ERROR:web_contents_delegate.cc(224)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
[0102/000902.272:ERROR:web_contents_delegate.cc(224)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
[0102/000902.475:INFO:CONSOLE(0)] "The resource https://js.driftt.com/core/assets/js/runtime~main.a73a2727.js was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://js.driftt.com/core/chat (0)
[0102/000906.041:INFO:CONSOLE(0)] "The resource https://js.zohocdn.com/ichat/js/73291e5e_wmsbridge.js was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://datadome.co/customers-stories/toppreise-ends-web-scraping-and-content-theft-with-datadome/ (0)

共有1个答案

陶裕
2023-03-14

chromeOptions()在selenium.webdriver.chrome.options中定义,但不在undetected_chromedriver中定义。

您可以使用以下解决方案:

>

  • 代码块:

    import undetected_chromedriver as uc
    from selenium import webdriver
    
    options = webdriver.ChromeOptions() 
    options.headless = True
    driver = uc.Chrome(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')
    driver.quit()
    print("Program Ended")
    

      null

    • 是否有任何可能的方法绕过cloudflare安全检查?

  •  类似资料:
    • 在我的项目中,我需要为所有@RestController bean映射添加前缀。所以我添加了这个配置类: 之后,我看到swagger无法使用默认地址正确预览,因此我添加了以下配置键: 现在我看到这个页面与正确的控制器映射,但当我尝试它, url添加前缀再次和地址更改为/rest/rest/... 怎么了? 我使用这个版本 spring启动程序父级= springdoc openapi数据rest

    • 但是,对于以下所有使用chromedriver的测试,浏览器都不能成功导航到URL。 浏览器启动,瞬间显示字符数据;出现在地址栏中(就像第一个测试中一样),然后将正确的URL插入到地址栏中。但是,页面永远不会加载,你得到了标准的chrome这个网页不可用的消息,在浏览器的正文/画布上有两个按钮reload和更多。 这是已知的问题吗? 以下异常将被删除: NosuchWindowException:

    • 我应该有一个正常的贴图如下: 但当我加载场景时,或者从inspector中的另一个场景切换(例如,单击“场景/菜单”,然后单击此场景),或者在游戏中转移到此场景(),精灵会随机不可见。 每次都有一些精灵隐形,下一次隐形的可能就不一样了。我怀疑这是Unity编辑器的问题,因为即使我不在播放模式下也会发生这种情况。 在中,我肯定会找到这些sprite(不是null)。他们就是不出现。我必须重新加载精灵

    • 日安。 我试着让我的电脑检测我的JDK,我想安装SDK管理器,对于eclipse,我的目标是运行一个虚拟的android设备。我已经安装了JDK,并设置了JAVA_HOME路径。下面是路径的一些片段。我目前正在运行Windows1064bit,没有找到任何链接到其他要做的事情。我已经找了一段时间了。 CMD错误消息 如果有人知道我做错了什么,请告诉我。

    • 当我尝试使用Selenium时,它在代码的第一行中给出了一个错误 代码: 错误: 当我使用Selenium Web驱动程序时,它不会给出此错误(它仅在我使用未检测到的chromedriver时发生) 我在装有Chrome 103的Ubuntu 20.04服务器上运行这段代码< br >并且我的一些服务器没有出现这个错误< br >并且我以同样的方式设置了所有的服务器

    • 我已经为我的mod.info提供了mcmod.info,但是在IntelliJ中运行Minecraft客户端后,mod确实加载了,但是它不能正确加载mcmod.info。在Minecraft客户端的启动过程中,有一条警告显示: [Client Thread/Warn][FML]:Mod testforge缺少所需的元素“version”,并且找不到后退。替换为“1.0”。 当我进入mod按钮并查找