First off, excuse me, I'm still learning
How he solved the captcha in this video starting at second 27
https://youtu.be/0h504QFDyxc?si=RckXYelnrvWyWHFA
Every time I solve the captcha on this site, it tells me that something is wrong. How do I overcome this problem?
I tried the code api 2captcha It did not succeed in solving it I use a library seleniumbase To control the browser
Continue changing between LEGALISATION Application Center for Croatia in Egypt and Visa Application Center for Croatia in Egypt for 30 minutes, then log out. You will find that Cloud Flare has disappeared and Google Captcha has appeared. If you fill in the data, it tells you that there are empty fields. I do not know how to bypass that.
videos to the problemhttps://drive.google.com/drive/folders/1QLqdwmPSjhnmC17qmhCyKrx4pK-zNYom
I stopped the api and installed a browser add-on that solves the captcha. What should I do? I am tired of this problem
# CLOUDFLARE SOLVERdef click_turnstile_and_verify(sb, excel_file_path): # Check for CloudFlare and click Mark Box sb.driver.uc_switch_to_frame("iframe") if sb.is_element_present("#challenge-stage > div > label > span.mark"): sb.driver.uc_click("#challenge-stage > div > label > span.mark") current_time = datetime.now().strftime("%I:%M:%S %p") print(colorama.Fore.LIGHTWHITE_EX + f"{current_time} - CloudFlare Mark Element found.") sb.driver.switch_to.default_content() else: current_time = datetime.now().strftime("%I:%M:%S %p") print(colorama.Fore.LIGHTCYAN_EX + f"{current_time} - CloudFlare Mark Element not found. Switching back...") sb.driver.switch_to.default_content() # Check for Google Captcha after switching back print(colorama.Fore.LIGHTMAGENTA_EX + f"{current_time} - Check for Google Captcha after switching back") if sb.is_element_present('//*[@id="g-recaptcha-response"]'): current_time = datetime.now().strftime("%I:%M:%S %p") handle_captcha(sb, excel_file_path) else: current_time = datetime.now().strftime("%I:%M:%S %p") print(colorama.Fore.LIGHTYELLOW_EX + f"{current_time} - Google Captcha element not found. Continuing...") # Add further actions or conditions if needed# GOOGLE CAPTCHA SOLVER# Function to solve CAPTCHA using 2captcha servicedef solve_captcha(sb): api_key = '2db0803c9ae16bf457413f863b94d6dc' # Replace this with your actual 2captcha API key solver = TwoCaptcha(api_key) # Switch to the first CAPTCHA iframe if there is one sb.driver.switch_to.default_content() captcha_element_1 = sb.driver.find_element_by_id('g-recaptcha-response') # Check if the first CAPTCHA element is found if captcha_element_1: # Print the data-sitekey attribute for the first CAPTCHA data_sitekey_1 = captcha_element_1.get_attribute('6LfDUY8bAAAAAPU5MWGT_w0x5M-8RdzC29SClOfI') print("First CAPTCHA Data Sitekey:", data_sitekey_1) # Get the first CAPTCHA image URL captcha_image_url_1 = captcha_element_1.get_attribute('src') # Solve the first CAPTCHA using 2captcha service try: result_1 = solver.normal(captcha_image_url_1) captcha_response_1 = result_1['code'] # Inject the captcha response into the first CAPTCHA form sb.driver.execute_script('arguments[0].setAttribute("data-callback", "submitCallback");', captcha_element_1) sb.driver.execute_script('arguments[0].setAttribute("data-response", "{}");'.format(captcha_response_1), captcha_element_1) current_time = datetime.now().strftime("%I:%M:%S %p") print(colorama.Fore.GREEN + f"{current_time} - First CAPTCHA solved successfully.") except Exception as e: current_time = datetime.now().strftime("%I:%M:%S %p") print(colorama.Fore.RED + f"{current_time} - Failed to solve First CAPTCHA: {e}") else: print("First CAPTCHA element not found.") # Switch to the second CAPTCHA iframe if there is one sb.driver.switch_to.default_content() sb.driver.switch_to.frame(sb.driver.find_element_by_xpath('/html/body/div[2]/div/div[1]/iframe')) # Find the second CAPTCHA element captcha_element_2 = sb.driver.find_element_by_id('g-recaptcha-response') # Check if the second CAPTCHA element is found if captcha_element_2: # Print the data-sitekey attribute for the second CAPTCHA data_sitekey_2 = captcha_element_2.get_attribute('6LdJReUUAAAAAPR1hddg-9JUC_TO13OrlKVpukHL') print("Second CAPTCHA Data Sitekey:", data_sitekey_2) # Get the second CAPTCHA image URL captcha_image_url_2 = captcha_element_2.get_attribute('src') # Solve the second CAPTCHA using 2captcha service try: result_2 = solver.normal(captcha_image_url_2) captcha_response_2 = result_2['code'] # Inject the captcha response into the second CAPTCHA form sb.driver.execute_script('arguments[0].setAttribute("data-callback", "submitCallback");', captcha_element_2) sb.driver.execute_script('arguments[0].setAttribute("data-response", "{}");'.format(captcha_response_2), captcha_element_2) current_time = datetime.now().strftime("%I:%M:%S %p") print(colorama.Fore.GREEN + f"{current_time} - Second CAPTCHA solved successfully.") except Exception as e: current_time = datetime.now().strftime("%I:%M:%S %p") print(colorama.Fore.RED + f"{current_time} - Failed to solve Second CAPTCHA: {e}") else: print("Second CAPTCHA element not found.")# Function to handle CAPTCHAdef handle_captcha(sb, excel_file_path): sb.driver.switch_to.default_content() if sb.is_element_present('//*[@id="g-recaptcha-response"]'): current_time = datetime.now().strftime("%I:%M:%S %p") print(colorama.Fore.LIGHTWHITE_EX + f"{current_time} - Google Captcha element found.") # Solve the reCAPTCHA sleep(7) else: current_time = datetime.now().strftime("%I:%M:%S %p") print(colorama.Fore.YELLOW + f"{current_time} - Google Captcha element not found. Continuing...") sb.driver.switch_to.default_content() # Add any further actions or conditions here if needed# FILL EMAIL AND PASSWORD LOGIN PAGEdef login(sb, excel_file_path): check_notification(sb, excel_file_path) try: sb.highlight_click('#onetrust-reject-all-handler') current_time = datetime.now().strftime("%I:%M:%S %p") print(colorama.Fore.BLUE + f"{current_time} - Cookies Click Button") sleep(2) except Exception as e: current_time = datetime.now().strftime("%I:%M:%S %p") print(f"{current_time} - Cookies button not found. Continuing...") # Handle the exception or continue the process accordingly pass CloudFlare = '/html/body/app-root/div/div/app-login/section/div/div/mat-card/form/app-cloudflare-captcha-container/div' if sb.is_element_present(CloudFlare): sb.highlight(CloudFlare) current_time = datetime.now().strftime("%I:%M:%S %p") print(colorama.Fore.WHITE + f"{current_time} - CloudFlare Captcha Found") else: current_time = datetime.now().strftime("%I:%M:%S %p") print(colorama.Fore.YELLOW + f"{current_time} - CloudFlare Captcha not found.") check_notification(sb, excel_file_path) # Search For Email Place and import sb.press_keys("#mat-input-0", str(email)) print(colorama.Fore.RED + f"{current_time} - Email Added") sleep(1) # Find the password input field and enter the password sb.press_keys("#mat-input-1", str(password)) print(colorama.Fore.WHITE + f"{current_time} - Password Added") sleep(1) try: # Wait for the reCAPTCHA iframe to load recaptcha_iframe = sb.highlight('//iframe[contains(@src, "recaptcha")]') # Switch to the reCAPTCHA iframe sb.driver.switch_to.frame(recaptcha_iframe) # Perform the necessary actions within the iframe # For example, click on the reCAPTCHA checkbox checkbox = sb.highlight('//div[@aria-checked="false"]') checkbox.click() # Switch back to the main content sb.driver.switch_to.default_content() except: print(colorama.Fore.LIGHTWHITE_EX + f"{current_time} - Google Captcha element found.") sb.highlight_click('button.mat-focus-indicator') current_time = datetime.now().strftime("%I:%M:%S %p") # Update current_time print(colorama.Fore.MAGENTA + f"{current_time} - Sign In (Button) click") check_notification(sb, excel_file_path) # Check for the error message if sb.is_text_visible("body > app-root > div > div > app-login > section > div > div > mat-card > form > div.errorMessage.ng-star-inserted > div"): current_time = datetime.now().strftime("%I:%M:%S %p") # Update current_time print(colorama.Fore.WHITE + f"{current_time} - 'Mandatory field cannot be left blank' error detected. Restarting the process.") sb.driver.quit() # Close the browser # Restart the process main_process() else: pass click_new_booking(sb, excel_file_path) sleep(2)