This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium.webdriver.common.action_chains import ActionChains |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delayTime = 6 #in seconds | |
def delay(): | |
""" | |
Delay between performing the task | |
""" | |
time.sleep(delayTime) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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 |