Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
Make test cases use undetected-chromedriver.
Browse files Browse the repository at this point in the history
  • Loading branch information
thicccat688 committed Feb 27, 2023
1 parent 45f9380 commit 0cb1ebb
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.ui import WebDriverWait
from selenium_recaptcha_solver import RecaptchaSolver, StandardDelayConfig
from selenium_stealth import stealth
from selenium import webdriver
from selenium.webdriver.common.by import By
import undetected_chromedriver as webdriver
import pytest


Expand All @@ -19,33 +17,16 @@
options.add_argument('--no-sandbox')
options.add_argument("--disable-extensions")


test_driver = webdriver.Chrome(options=options)


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


solver = RecaptchaSolver(driver=test_driver, delay_config=StandardDelayConfig())


def test_solver():
try:
test_driver.get('https://www.google.com/recaptcha/api2/demo')

element = ('xpath', '//iframe[@title="reCAPTCHA"]')

WebDriverWait(test_driver, 5).until(ec.visibility_of_element_located(element))

recaptcha_iframe = test_driver.find_element(*element)
recaptcha_iframe = test_driver.find_element(By.XPATH, '//iframe[@title="reCAPTCHA"]')

solver.click_recaptcha_v2(iframe=recaptcha_iframe)

Expand Down

0 comments on commit 0cb1ebb

Please sign in to comment.