From fb2bd36f9cfdaff120a07d9a1521c07c5eb13585 Mon Sep 17 00:00:00 2001 From: DedInc Date: Sat, 16 Jul 2022 13:36:47 +0600 Subject: [PATCH] v1.2.3 --- README.MD | 4 +++- byerecaptcha/byerecaptcha.py | 16 +++++++++------- setup.py | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.MD b/README.MD index 45948aa..51b0eb3 100644 --- a/README.MD +++ b/README.MD @@ -22,5 +22,7 @@ driver = webdriver.Chrome(executable_path=getChromeDriver(), chrome_options=opti driver.get('https://www.google.com/recaptcha/api2/demo') solveRecaptcha(driver) #FOR PREDICTION ON YOUR PC -solveRecaptcha(driver, "https://myserver.com") #FOR PREDICTION IN YOUR SERVER (check server.py) +solveRecaptcha(driver, server="https://myserver.com") #FOR PREDICTION IN YOUR SERVER (check server.py) + +solveRecaptcha(driver, invisible=True) #FOR PREDICTION INVISIBLE CAPTCHA ``` \ No newline at end of file diff --git a/byerecaptcha/byerecaptcha.py b/byerecaptcha/byerecaptcha.py index 00fe8b7..812814f 100644 --- a/byerecaptcha/byerecaptcha.py +++ b/byerecaptcha/byerecaptcha.py @@ -73,11 +73,12 @@ def clickVerify(): driver.find_element_by_id('recaptcha-verify-button').click() driver.switch_to.parent_frame() -def getFrames(): +def getFrames(invisible=False): global recaptchaFrame, CheckBox, imageFrame recaptchaFrame = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.TAG_NAME, 'iframe'))) driver.switch_to.frame(recaptchaFrame) - CheckBox = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "recaptcha-anchor"))) + if not invisible: + CheckBox = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "recaptcha-anchor"))) driver.switch_to.parent_frame() while True: frames = WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, 'iframe[src*="api2/bframe"]'))) @@ -346,7 +347,7 @@ def solveImage(): if result: return result -def solveRecaptcha(browser, server=''): +def solveRecaptcha(browser, server='', invisible=False): global driver, serverSolve, serverUrl if server == '': @@ -364,12 +365,13 @@ def solveRecaptcha(browser, server=''): serverUrl = server serverSolve = True - driver = browser - getFrames() - clickCheckBox() + driver = browser + if not invisible: + getFrames(invisible) + clickCheckBox() while True: try: - getFrames() + getFrames(invisible) driver.switch_to.frame(imageFrame) driver.switch_to.parent_frame() break diff --git a/setup.py b/setup.py index f33252d..105b4ba 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name='byerecaptcha', - version='1.2.2', + version='1.2.3', author='Maehdakvan', author_email='visitanimation@google.com', description='Google Recaptcha solver with selenium.',