ultrafunkamsterdam / undetected-chromedriver

Custom Selenium Chromedriver | Zero-Config | Passes ALL bot mitigation systems (like Distil / Imperva/ Datadadome / CloudFlare IUAM)
https://github.com/UltrafunkAmsterdam/undetected-chromedriver
GNU General Public License v3.0
9.59k stars 1.14k forks source link

Fail to click in headless or minimization mode #598

Closed donggoing closed 2 years ago

donggoing commented 2 years ago

i am doing something with geetest captcha, when i click the verification button, it should show the captcha with images but it doesn't in headless or minimization mode. While it works fine when the browser is visible or using the normal webdriver in headless mode.

donggoing commented 2 years ago

Does anybody have any ideas?Thanks in advance!

QIN2DIM commented 2 years ago

Can you provide me with some test environments to replicate, such as a pristine captcha site?

donggoing commented 2 years ago

Can you provide me with some test environments to replicate, such as a pristine captcha site?

Like this site. What i want to do is to click the .geetest_radar_btn button, then get images in div.geetest_widget like .geetest_canvas_bg's image. But in headless mode, it seems doesn't work. When i click, div.geetest_widget just doesn't show up, while it works when the browser is visible.

donggoing commented 2 years ago

btw, the version i'm using is the latest(3.1.5.post4).

QIN2DIM commented 2 years ago

When i click, div.geetest_widget just doesn't show up,

whats mean,Are you saying that the box won't load, or that the image won't render.

QIN2DIM commented 2 years ago

I have done similar work (homework, I will send a demo repository here.

donggoing commented 2 years ago

When i click, div.geetest_widget just doesn't show up,

whats mean,Are you saying that the box won't load, or that the image won't render.

the box won't load.

QIN2DIM commented 2 years ago

https://github.com/QIN2DIM/armour-geetest

You can check out this project, it's very old, but it's good that it still works :) btw, i did not use undetected_chromedriver in the armour-geetest.

run the main.py to startup project and modify the silence parameter to control the headless mode.

The meaningful log output of this project is expressed in Chinese.

QIN2DIM commented 2 years ago

蚌珠了,难道是核善的网友。

donggoing commented 2 years ago

蚌珠了,难道是核善的网友。

哈哈哈哈,我之前不用undetected_chromedriver的时候时可以的,就是反爬升级换到这个driver之后只要最小化或者headless点击geetest_radar_btn不弹出图片框。

QIN2DIM commented 2 years ago

极验和 Google reCAPTCHA 以及 hCaptcha 都差远了,两者都不是一个段位的,只有后面说的这两种以及 FunCaptcha 需要使用 undetected_chromedriver 隐藏浏览器特征。

极验前端不存在检测用户行为代码,它相当于是直接插入在前端网页中的模块,在配置 ChromeOptions() 时需要留意,否则挑战需要用到的图片以及渲染脚本会被禁止运行。

至于 undetected_chromedriver headless 无法弹出拼图窗口的情况我还没测试过,也可能是你的打开方式不太对。

极验存在 v2 和 v3 两个版本,v2 的话直接把缺口完全对齐就能通过。v3需要拟人化的轨迹和加速度。这些检测都是在 iframe 中独立计算的,不会涉及到判断浏览器特征的东西,所以用普通的 selenium 就能处理。

donggoing commented 2 years ago

之前我用官方的webdriver一直是可以的,最近突然不行了(就是开启某个使用极验服务的网页就显示ip被封了,也可能是datadome的问题?不大清楚)。

主要我不清楚具体是哪里被检测出来了,但是换成undetected_chromedriver就可以了,现在就是需要解决headless的问题就好了(

sebdelsol commented 2 years ago

Please try options.add_argument("--start-maximized"). If I remember correctly, even headless Chrome needs to have an element "shown" in the canvas to be clickable.

donggoing commented 2 years ago

Please try options.add_argument("--start-maximized"). If I remember correctly, even headless Chrome needs to have an element "shown" in the canvas to be clickable.

I tried, but it doesn't work neither.

donggoing commented 2 years ago

I figure it out... I thought this drive could be anonymous automatically, so i don't check the options carefully. After adding driver_options.add_argument("--disable-blink-features=AutomationControlled"), it works.

Thanks a lot!

QIN2DIM commented 2 years ago

极验和 Google reCAPTCHA 以及 hCaptcha 都差远了,两者都不是一个段位的,只有后面说的这两种以及 FunCaptcha 需要使用 undetected_chromedriver 隐藏浏览器特征。

极验前端不存在检测用户行为代码,它相当于是直接插入在前端网页中的模块,在配置 ChromeOptions() 时需要留意,否则挑战需要用到的图片以及渲染脚本会被禁止运行。

至于 undetected_chromedriver headless 无法弹出拼图窗口的情况我还没测试过,也可能是你的打开方式不太对。

极验存在 v2 和 v3 两个版本,v2 的话直接把缺口完全对齐就能通过。v3需要拟人化的轨迹和加速度。这些检测都是在 iframe 中独立计算的,不会涉及到判断浏览器特征的东西,所以用普通的 selenium 就能处理。

敲,特地來回復一下。之前説到 GeeTest 的種種不足,只能說我太膚淺了。我上次運行關於 GeeTest 的代碼還是兩年前事情,沒想到現在这么花里胡哨了!!

image

image

donggoing commented 2 years ago

敲,特地來回復一下。之前説到 GeeTest 的種種不足,只能說我太膚淺了。我上次運行關於 GeeTest 的代碼還是兩年前事情,沒想到現在这么花里胡哨了!!

毕竟是商业化的,要恰饭的嘛:)

QIN2DIM commented 2 years ago

毕竟是商业化的,要恰饭的嘛:)

但从我的经验来看,能够对抗机器人的只有特征检测,浮于表面看起来花里胡哨的验证逻辑只会把人类挡在外面。

donggoing commented 2 years ago

毕竟是商业化的,要恰饭的嘛:)

但从我的经验来看,能够对抗机器人的只有特征检测,浮于表面看起来花里胡哨的验证逻辑只会把人类挡在外面。

同意~