Python selenium.webdriver.common.keys.Keys.ALT Examples
The following are 4
code examples of selenium.webdriver.common.keys.Keys.ALT().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
selenium.webdriver.common.keys.Keys
, or try the search function
.
Example #1
Source File: ris.py From uncaptcha with MIT License | 11 votes |
def start_captcha(): driver = webdriver.Firefox() driver.get("http://reddit.com") driver.find_element(By.XPATH, "//*[@id=\"header-bottom-right\"]/span[1]/a").click() time.sleep(1) driver.find_element(By.ID, "user_reg").send_keys("qwertyuiop091231") driver.find_element(By.ID, "passwd_reg").send_keys("THISISMYPASSWORD!!$") driver.find_element(By.ID, "passwd2_reg").send_keys("THISISMYPASSWORD!!$") driver.find_element(By.ID, "email_reg").send_keys("biggie.smalls123@gmail.com") #driver.find_element_by_tag_name("body").send_keys(Keys.COMMAND + Keys.ALT + 'k') iframeSwitch = driver.find_element(By.XPATH, "//*[@id=\"register-form\"]/div[6]/div/div/div/iframe") driver.switch_to.frame(iframeSwitch) driver.find_element(By.ID, "recaptcha-anchor").click() # download captcha image # # split payload # # reverse_search # # driver.quit() # determines if an image keywords matches the target keyword # uses the synonyms of the image keyword
Example #2
Source File: testvideo.py From netflix-proxy with MIT License | 5 votes |
def enablePlayerDiagnostics(self): actions = ActionChains(self.driver) actions.key_down(Keys.CONTROL).key_down(Keys.ALT).key_down(Keys.SHIFT).send_keys('d').perform()
Example #3
Source File: browser_mgmt.py From warriorframework with Apache License 2.0 | 4 votes |
def switch_tab(self, browser_instance=None, tab_number=None, browser_type="firefox"): """Switching to different tabs in a browser with unique tab_number""" status = True if browser_instance is None: browser_instance = self.current_browser if tab_number is not None: try: tab_number = int(tab_number) except: print_error("{0} is not a valid tab number".format(tab_number)) status = False else: if tab_number > len(browser_instance.window_handles) or tab_number < 1: print_error("{0} is not a valid tab number".format(tab_number)) status = False else: tab_number -= 1 current_tab = 0 current_window_handle = browser_instance.current_window_handle for i in range(0, len(browser_instance.window_handles)): if browser_instance.window_handles[i] == current_window_handle: current_tab = i break if tab_number != current_tab: if current_tab < tab_number: times = tab_number - current_tab else: times = len(browser_instance.window_handles) - current_tab times += tab_number if browser_type == "firefox": action_chains = ActionChains(browser_instance) action_chains.key_down(Keys.ALT) for i in range(0, times): action_chains.send_keys('`') action_chains.perform() else: element = browser_instance.find_element_by_tag_name('body') for i in range(0, times): element.send_keys(Keys.LEFT_CONTROL, Keys.TAB) browser_instance.switch_to.window(browser_instance.window_handles[tab_number]) else: current_tab = 0 current_window_handle = browser_instance.current_window_handle for i in range(0, len(browser_instance.window_handles)): if browser_instance.window_handles[i] == current_window_handle: current_tab = i tab_number = current_tab + 1 if tab_number >= len(browser_instance.window_handles): tab_number = 0 if browser_type == "firefox": browser_instance.find_element_by_tag_name('body').send_keys(Keys.LEFT_ALT, '`') else: browser_instance.find_element_by_tag_name('body').send_keys(Keys.LEFT_CONTROL, Keys.TAB) browser_instance.switch_to.window(browser_instance.window_handles[tab_number]) return status
Example #4
Source File: browser_mgmt.py From warriorframework with Apache License 2.0 | 4 votes |
def close_tab(self, browser_instance=None, tab_number=None, browser_type="firefox"): """Closing tabs in a browser with unique tab_number""" if browser_instance is None: browser_instance = self.current_browser if len(browser_instance.window_handles) > 1: prior_current_tab = False current_window_handler = browser_instance.current_window_handle for i in range(0, len(browser_instance.window_handles)): if browser_instance.window_handles[i] == current_window_handler: prior_current_tab = i status = True if tab_number is not None: status = self.switch_tab(browser_instance, tab_number, browser_type) if status: tab_number = int(tab_number) - 1 browser_instance.find_element_by_tag_name('body').send_keys(Keys.LEFT_CONTROL, 'w') sleep(2) if tab_number == len(browser_instance.window_handles): tab_number -= 1 browser_instance.switch_to.window(browser_instance.window_handles[tab_number]) if prior_current_tab == len(browser_instance.window_handles): prior_current_tab -= 1 if prior_current_tab != tab_number: if tab_number < prior_current_tab: times = prior_current_tab - tab_number else: times = len(browser_instance.window_handles) - tab_number times += prior_current_tab if browser_type == "firefox": action_chains = ActionChains(browser_instance) action_chains.key_down(Keys.ALT) for i in range(0, times): action_chains.send_keys('`') action_chains.perform() else: element = browser_instance.find_element_by_tag_name('body') for i in range(0, times): element.send_keys(Keys.LEFT_CONTROL, Keys.TAB) browser_instance.switch_to.window(browser_instance.window_handles[prior_current_tab]) else: if browser_type == "firefox": print_info("The tab_number argument is None. Current window will be closed") else: print_info("The tab_number argument is None. Current tab will be closed") browser_instance.find_element_by_tag_name('body').send_keys(Keys.LEFT_CONTROL, 'w') if prior_current_tab == len(browser_instance.window_handles): prior_current_tab = 0 browser_instance.switch_to.window(browser_instance.window_handles[prior_current_tab]) else: status = self.close_browser(browser_instance) return status