Skip to content

Instantly share code, notes, and snippets.

View theshahzaibc's full-sized avatar
👌
Curios to learn!

Shahzaib Chadhar theshahzaibc

👌
Curios to learn!
View GitHub Profile
"""
ByPass Google reCAPTCHA V2
Shahzaib Chadhar
YouTube Channel: NIKO TECH
"""
import urllib
import selenium
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
if audioBtnFound:
# if audio button found then procced
delay()
try:
while True:
# get the mp3 audio file
src = driver.find_element_by_id("audio-source").get_attribute("src")
print("[INFO] Audio src: %s" % src)
delay()
iframes = driver.find_elements_by_tag_name('iframe')
audioBtnFound = False
audioBtnIndex = -1
# go to audio solution
for index in range(len(iframes)):
driver.switch_to.default_content()
iframe = driver.find_elements_by_tag_name('iframe')[index]
# delay()
driver.switch_to.frame(iframe)
driver.get(URL)
print("Getting Captcha")
g_recaptcha = WebDriverWait(driver, 100).until(EC.presence_of_element_located((By.ID, recaptchaId)))
outerIframe = g_recaptcha.find_element_by_tag_name('iframe')
print("Got captcha")
ActionChains(driver).move_to_element(outerIframe).pause(3).click(outerIframe).perform()
if isBlocked():
sys.exit("Caught/Blocked by Google")
def isBlocked():
try:
errors = driver.find_element_by_class_name('rc-doscaptcha-header-text')
print("TEXT: ", errors.text)
if errors.text == "Try again later":
return True
return False
except selenium.common.exceptions.NoSuchElementException:
return False
def audioToText(audioFile):
""" Converting audio mp3 to text """
driver.execute_script('''window.open("","_blank")''')
driver.switch_to.window(driver.window_handles[1])
driver.get(SpeechToTextURL)
delay()
audioInput = driver.find_element(By.XPATH, '//*[@id="root"]/div/input')
# upload file mp3 to input
delayTime = 6 #in seconds
def delay():
"""
Delay between performing the task
"""
time.sleep(delayTime)
import urllib
import selenium
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import os
import sys
import time
from fake_useragent import UserAgent
from selenium.webdriver.common.action_chains import ActionChains
menu = driver.find_element_by_id("menu")
submenu = driver.find_element_by_id("submenu1")
ActionChains(driver)
.move_to_element(menu)
.click(submenu)
.perform()
@theshahzaibc
theshahzaibc / import.py
Last active January 5, 2021 18:59
Import ActionsChains in Python Selenium
from selenium.webdriver.common.action_chains import ActionChains