Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How To Bypass Cloudflare on Second Page? #2964

Answered by mdmintz
khanjui asked this question in Q&A
Discussion options

driver = Driver(uc=True, agent=agent)
url = "https://visa.vfsglobal.com/tur/en/pol/login"
driver.uc_open_with_reconnect(url, reconnect_time=40)

I can make the automation work on the first (login) page by using reconnect_time, but there is an additional Cloudflare check on the second page after logging in which detects the Selenium and fails to pass even if I manually click it. @mdmintz

First page
image
Second page
image

You must be logged in to vote

Use methods such as sb.uc_gui_click_captcha() to get past the CAPTCHA.
(Read the docs here: SeleniumBase/help_docs/uc_mode.md)
Also be sure you are using seleniumbase 4.29.2 (or newer if available).

Replies: 4 comments 18 replies

Comment options

Use methods such as sb.uc_gui_click_captcha() to get past the CAPTCHA.
(Read the docs here: SeleniumBase/help_docs/uc_mode.md)
Also be sure you are using seleniumbase 4.29.2 (or newer if available).

You must be logged in to vote
2 replies
Comment options

Use methods such as sb.uc_gui_click_captcha() to get past the CAPTCHA. (Read the docs here: SeleniumBase/help_docs/uc_mode.md) Also be sure you are using seleniumbase 4.29.2 (or newer if available).

I was trying everything one by one and ended up with a simple driver.disconnect() and driver.reconnect(15) being working. Thank you. Maybe a bit out of topic but is there an easy way to use/automate OTP code that comes as SMS on every login?

Comment options

If you know the 16-character code that generates the 6-digit code, then there are built-in SeleniumBase methods for handling that. Here's an example test that uses MFA: SeleniumBase/examples/test_mfa_login.py

Answer selected by khanjui
Comment options

good morning khanjui,

Can you share you code to bypass the first login please

You must be logged in to vote
2 replies
Comment options

from seleniumbase import SB
with SB(uc=True, incognito=True) as sb:
 sb.uc_open_with_reconnect(
 "https://visa.vfsglobal.com/are/en/fra/login", 12
 )
 sb.click_if_visible("#onetrust-reject-all-handler")
 sb.uc_gui_click_captcha()
Comment options

i try this but not checking the claudflare checkbox

Comment options

@mdmintz Man! you're a legend.

You must be logged in to vote
3 replies
Comment options

@mdmintz @khanjui It successfully solves the Cloudflare CAPTCHA on the first attempt, but when I click the sign-in button, it prompts me to resolve it again. Could you please assist me with this issue?
This is my code snippet:

def access_website_with_solution():
 email = 'fahadali7200@gmail.com'
 password = ''
 with SB(uc=True, incognito=True) as sb:
 sb.uc_open_with_reconnect(
 "https://visa.vfsglobal.com/are/en/fra/login", 17
 )
 sb.click_if_visible("#onetrust-reject-all-handler")
 email_input = sb.find_element(By.ID, 'email')
 email_input.send_keys(email)
 password_input = sb.find_element(By.ID, 'password')
 password_input.send_keys(password)
 signin_button = sb.find_element(By.XPATH,'/html/body/app-root/div/div/app-login/section/div/div/mat-card/form/button')
 signin_button.click()
 time.sleep(5)
Screenshot 2024年10月01日 at 7 59 43 PM Screenshot 2024年10月01日 at 8 00 11 PM
Comment options

That situation was covered in the 3rd UC Mode video tutorial: https://www.youtube.com/watch?v=-EpZlhGWo9k

Screenshot

You used a regular click before encountering a CAPTCHA, which is how they detected you. Need to use uc_click(selector).

If they catch you (because you didn't use stealth), then they may IP-block you, as they did:

Screenshot
Comment options

@mdmintz I repeat you're a gem. Thanks a lot for saving my life. 🫠

Comment options

@khanjui How did you pass the 2nd cloudflare, my friend? I can pass the 1st one too. I get stuck on the 2nd one and I get a failed message. Can you help me?

You must be logged in to vote
8 replies
Comment options

Yes, I was able to pass the OTP part.

Brother can you help me too I need you

Comment options

@tengriG telegram hesabım yaz kardeşim

Comment options

@jesushealth could you also help me? I cant pass cloudflare validation which opens on new page after form submition. I'm using uc mode. Works fine when manually clicking but gui captcha click fails

Comment options

@krzysztofkub tg : @tengriG I can help you can send a message

Comment options

People should be switching to SeleniumBase CDP Mode.
Regular UC Mode isn't always enough for this anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /