Every line of 'python selenium switch to iframe' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
456 def SwitchFrame(self, frame, tagname=None): 457 """Switch to a different frame in web page. 458 459 Args: 460 frame: string, frame to switch to. 461 tagname: string, name of iframe tag. 462 Returns: 463 boolean: True = frame switched, False = frame not switched. 464 """ 465 try: 466 if tagname: 467 self.GetWait().until(EC.frame_to_be_available_and_switch_to_it( 468 self.driver.find_element_by_tag_name(tagname))) 469 else: 470 self.GetWait().until(EC.frame_to_be_available_and_switch_to_it(frame)) 471 except TimeoutException: 472 self.logger.error('Timed out finding frame: %s', frame) 473 return False 474 except NoSuchFrameException: 475 self.logger.warning('Frame named %s not found.', frame) 476 return False 477 return True
775 def switch_to_window(self, window_name): 776 """ Deprecated use driver.switch_to.window 777 """ 778 warnings.warn("use driver.switch_to.window instead", DeprecationWarning) 779 self._switch_to.window(window_name)
256 @abstractmethod 257 def switch_to_frame(self, frame_reference): 258 # type: () -> None 259 pass
1775 def switch_to_frame(frame): 1776 """Switch to frame. 1777 frame must be the index, name, or the frame webelement itself. 1778 1779 Parameters: 1780 frame : value 1781 """ 1782 with _step('Switch to frame {}'.format(frame), take_screenshots=False): 1783 get_browser().switch_to.frame(frame)
39 @property 40 def switch_to(self): 41 return self.__getattr_from_webdriver_or_webelement__('switch_to')
14 def test_iframe_navigation(session): 15 """ 16 Webcontent-edit keymaps are used even in sub frames. 17 """ 18 session.load_page("iframe_follow", wait_iframes=True) 19 20 session.wkeyclicks("Tab") 21 session.check_javascript("%s === document.activeElement" % INPUT0, True) 22 23 # type some text in INPUT0 and move word backward 24 25 session.keyclicks("hello world") 26 session.check_javascript("%s.value" % INPUT0, "hello world") 27 session.check_javascript("%s.selectionEnd" % INPUT0, 11) 28 session.wkeyclicks("M-b") 29 session.check_javascript("%s.selectionEnd" % INPUT0, 6) 30 31 session.wkeyclicks("Tab") 32 session.check_javascript("%s === window.frames[0].document.activeElement" 33 % INPUT0_IFRAME, True) 34 35 # type some text in INPUT0 inside the iframe and move word backward 36 session.keyclicks("hello world2") 37 session.check_javascript("%s.value" % INPUT0_IFRAME, "hello world2") 38 session.check_javascript("%s.selectionEnd" % INPUT0_IFRAME, 12) 39 session.wkeyclicks("M-b") 40 session.check_javascript("%s.selectionEnd" % INPUT0_IFRAME, 6)
251 @abstractmethod 252 def switch_to_window(self, window_name): 253 # type: () -> None 254 pass
99 def switchIframe(self,driver,para_list): 100 """ 101 Swith to specified iframe. 102 103 :param driver: 104 :param para_list: [method, value] eg : ['id','iframe-main'] 105 """ 106 method, value = para_list[0], para_list[1] 107 if method=='css': 108 method = By.CSS_SELECTOR 109 driver.switch_to_frame(driver.find_element(by = method,value=value)) 110 time.sleep(2)