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
self.log("Wait") | |
driver.implicitly_wait(5) | |
self.log("Switch") | |
driver.switch_to.frame(driver.find_elements_by_tag_name("iframe")[0]) |
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.switch_to.default_content() | |
iframes = driver.find_elements_by_tag_name("iframe") | |
driver.switch_to.frame(iframes[1]) | |
self.wait_between(LONG_MIN_RAND, LONG_MAX_RAND) | |
capt_btn = WebDriverWait(driver, 50).until( | |
EC.element_to_be_clickable((By.XPATH ,'//button[@id="solver-button"]')) | |
) |
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
self.log("Wait") | |
self.wait_between(LONG_MIN_RAND, LONG_MAX_RAND) | |
self.log("Find audio button") | |
audio_btn = WebDriverWait(driver, 50).until( | |
EC.element_to_be_clickable((By.XPATH ,'//button[@id="recaptcha-audio-button"]')) | |
) | |
self.log("Wait") | |
driver.implicitly_wait(10) |
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
self.log("Click") | |
check_box.click() | |
self.log("Wait") | |
self.wait_between(MIN_RAND, MAX_RAND) | |
action = ActionChains(driver); | |
self.human_like_mouse_move(action, check_box) | |
self.log("Switch") |
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
# Using B-spline for simulate humane like mouse movments | |
def human_like_mouse_move(self, action, start_element): | |
points = [[6, 2], [3, 2],[0, 0], [0, 2]]; | |
points = np.array(points) | |
x = points[:,0] | |
y = points[:,1] | |
t = range(len(points)) |
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
self.log("Switch to new frame") | |
driver.switch_to.frame(driver.find_elements_by_tag_name("iframe")[0]) | |
self.log("Wait for recaptcha-anchor") | |
check_box = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID ,"recaptcha-anchor"))) | |
self.log("Wait") | |
self.wait_between(MIN_RAND, MAX_RAND) | |
action = ActionChains(driver); |
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
self.wait_between(MIN_RAND, MAX_RAND) # wait | |
search_btn = WebDriverWait(driver, 20).until( EC.presence_of_element_located((By.ID ,"submit"))) | |
# Wait again | |
self.wait_between(MIN_RAND, MAX_RAND) | |
search_btn.click() # click on submit | |
self.wait_between(LONG_MIN_RAND, LONG_MAX_RAND) # wait again |
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 setUpOptions(self): | |
self.options = webdriver.FirefoxOptions() | |
self.options.headless = self.headless |
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
phone_input = driver.find_element_by_xpath('//*[@id="mobile-number"]') # find input by xpath | |
phone_input.send_keys(number) # send number | |
self.wait_between(MIN_RAND, MAX_RAND) # wait for random seconds |
NewerOlder