Why cant I go around the Recaptcha the second time?

141 Views Asked by At

I am currently writing a program to log in to investors.com. I am using selenium to write my program. Initially, whenever I click on the "Sign In" button. The website would take me to a page where I had to click and hold a button to pass a Recaptcha for human verification. I was able to bypass this Recaptcha by adding some chrome options and selenium-stealth to my program. It allowed me to go directly to the sign-in page without asking me for verification. Sadly, when I entered my credentials and tried to sign in. The website took me to the click-and-hold ReCaptcha again. My question is, what can I do to go around this Recaptcha like I did the first time? This doesn't happen when I use regular chrome. Is there anything else I could do to my program to avoid this Recaptcha? Any advice would be appreciated.

Things I have done to my program so far:

1: I am not making too many requests in a small period of time. 2: Make sure to sleep my program for at least 5-10 seconds between each command execution to simulate human-like behavior. 3: Using selenium stealth.

Things, I have used already: 1: Undetectable chromedriver(Did not solve the problem)(Got Detected!)

Why I dont want to solve the Recaptcha: I have manually tried to solve the recaptcha a few times and it allowed me to get access to the page. The problem is that if you try to solve the recaptcha with a program. It rejects the verification and asks the program to do it again. Sadly, no matter how many times you do it with a program it will not allow you to get access.

My code:

from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium_stealth import stealth

#Setting the user agent
options  = webdriver.ChromeOptions()
options.add_argument("--disable-blink-features")
options.add_argument('--disable-blink-features=AutomationControlled')
# options.add_argument("--disable-extensions")
options.add_argument("start-maximized")
#options.add_argument("--headless")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
# options.add_argument("--disable-blink-features=AutomationControlled")
#Initlazing Chrome Driver
driver = webdriver.Chrome(executable_path='C:/SeliniumWebDrivers/chromedriver.exe',options=options)

stealth(driver,
        languages=["en-US", "en"],
        vendor="Google Inc.",
        platform="Win32",
        webgl_vendor="Intel Inc.",
        renderer="Intel Iris OpenGL Engine")

driver.get('https://www.investors.com/')
driver.implicitly_wait(5)
driver.find_element(By.LINK_TEXT, 'Sign In').click()

# time to login
# Credentials:
username = 'username'
password = 'password'

#Login time
WebDriverWait(driver, 100).until(EC.frame_to_be_available_and_switch_to_it((By.XPATH, "//*[@id='signin-iframe']")))
time.sleep(10)
WebDriverWait(driver, 100).until(EC.presence_of_element_located((By.XPATH, "//*[@id='gigya-login-form']/div[2]/div[3]/div[1]/input"))).send_keys(username)
time.sleep(10)
WebDriverWait(driver, 100).until(EC.presence_of_element_located((By.XPATH, "//*[@id='gigya-login-form']/div[2]/div[3]/div[2]/input"))).send_keys(password)
driver.implicitly_wait(5)
WebDriverWait(driver, 100).until(EC.presence_of_element_located((By.XPATH, "//*[@id='gigya-login-form']/div[2]/div[3]/div[6]/input"))).click()
time.sleep(60)
driver.refresh()

human_verificaton = WebDriverWait(driver, 100).until(EC.presence_of_element_located((By.XPATH, "/html/body/section/div[2]/div/h1")))
if human_verificaton.text == "Please verify you are a human":
    #Human verification Needed
    print("Gottem")
#Sleepy time
time.sleep(100)

The recaptcha I need to go around: enter image description here

Any help would be appreciated!

0

There are 0 best solutions below