OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to bypass cloudflare in selenium webdriver python [closed]

  • Thread starter Thread starter Freyr
  • Start date Start date
F

Freyr

Guest
I can’t bypass cloudflare protection in selenium webdriver (I am using chrome webdriver). The protection page contains only a checkbox, that says “verify that you are human”, there is no complex captcha or anything. And it doesn’t work even when I click the checkbox manually. It’s really weird because I can easily do it in my main browser.

I have enabled this option: --disable-blink-features=AutomationControlled It didn’t help.

Even tried some other options:

options.add_experimental_option("excludeSwitches", ["enable-automation"]) options.add_experimental_option('useAutomationExtension', False)

And it still didn’t work.

I suppose there must be some option in selenium chrome driver that should solve this problem. Or can it be because my chrome version is too old?

Upd: I am trying to solve this using seleniumbase, but it doesn’t help. It appears that this is because I am using it with metamask extension and it overrides the UC mode

Code:
from seleniumbase import SB 
...
with SB(uc=True, incognito=True, proxy=proxy, agent=agent, extension_dir='metamask-chrome-11.16.3') as sb: 
    ...
    # the code fore bypassing cloudflare: 
    sb.driver.uc_open_with_reconnect(url, 3) 
    sb.driver.switch_to_frame('iframe') 
    sb.uc_click('#challenge-stage > div > label > input[type=checkbosx]', reconnect_time=4) 
...

Proxy is in the format: user:password@ip:port

Upd2: I have tried using seleniumwire undetected mode, seleniumbase, undetected chrome driver, none of these options worked. Also I tried editing the chrome driver file with hexeditor to remove the console variables that have cdc (I tried to do that because I found out that cloudflare looks for them to see if you’re a bot) in them, but then selenium can’t gives win32 api error
<p>I can’t bypass cloudflare protection in selenium webdriver (I am using chrome webdriver).
The protection page contains only a checkbox, that says “verify that you are human”, there is no complex captcha or anything. And it doesn’t work even when I click the checkbox manually.
It’s really weird because I can easily do it in my main browser.</p>
<p>I have enabled this option:
<code>--disable-blink-features=AutomationControlled</code>
It didn’t help.</p>
<p>Even tried some other options:</p>
<p><code>options.add_experimental_option("excludeSwitches", ["enable-automation"])</code>
<code>options.add_experimental_option('useAutomationExtension', False)</code></p>
<p>And it still didn’t work.</p>
<p>I suppose there must be some option in selenium chrome driver that should solve this problem.
Or can it be because my chrome version is too old?</p>
<p>Upd: I am trying to solve this using seleniumbase, but it doesn’t help. It appears that this is because I am using it with metamask extension and it overrides the UC mode</p>
<pre><code>from seleniumbase import SB
...
with SB(uc=True, incognito=True, proxy=proxy, agent=agent, extension_dir='metamask-chrome-11.16.3') as sb:
...
# the code fore bypassing cloudflare:
sb.driver.uc_open_with_reconnect(url, 3)
sb.driver.switch_to_frame('iframe')
sb.uc_click('#challenge-stage > div > label > input[type=checkbosx]', reconnect_time=4)
...
</code></pre>
<p>Proxy is in the format: user:password@ip:port</p>
<p>Upd2:
I have tried using seleniumwire undetected mode, seleniumbase, undetected chrome driver, none of these options worked.
Also I tried editing the chrome driver file with hexeditor to remove the console variables that have cdc (I tried to do that because I found out that cloudflare looks for them to see if you’re a bot) in them, but then selenium can’t gives win32 api error</p>
 

Latest posts

Online statistics

Members online
0
Guests online
3
Total visitors
3
Ads by Eonads
Top