I want to scrape rusprofile.ru using Selenium chromedriver Python. This site has a recaptcha, I know that. I want to connect a captcha recognition service.
But for some reason, captcha appears only in my personal browser. At this time, the browsers that I enter using Selenium Python get HTTP ERROR 429.
And only when I confirm the captcha in a personal browser, I can go to the site using Selenium. How can I make captcha appear in Selenium chromedriver browser?
url = 'https://www.rusprofile.ru/search?query=1027806061425&search_inactive=0'
options = webdriver.ChromeOptions()
options.add_argument('log-level=3')
options.add_argument('headless')
options.add_argument('User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/35.0.1916.153 Safari/537.36')
options.add_argument('user-data-dir=selenium')
driver = webdriver.Chrome(chrome_options=options,)
driver.get(url)
try:
capcha_text = driver.find_element_by_xpath('//p[@text()="Активность с вашего IP-адреса была распознана как автоматическая. Нам необходимо убедиться, что вы человек."]')
print('CAPCHA IS HERE')
captcha = driver.find_element_by_xpath('//p[@class="g-recaptcha"]')
print('CAPCHA IS HERE X2')
except Exception as e:
print(str(e))