Python selenium.common.exceptions 模块,NoSuchFrameException() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用selenium.common.exceptions.NoSuchFrameException()

项目:leetcode    作者:thomasyimgit    | 项目源码 | 文件源码
def frame(self, frame_reference):
        """
        Switches focus to the specified frame, by index, name, or webelement.

        :Args:
         - frame_reference: The name of the window to switch to, an integer representing the index,
                            or a webelement that is an (i)frame to switch to.

        :Usage:
            driver.switch_to.frame('frame_name')
            driver.switch_to.frame(1)
            driver.switch_to.frame(driver.find_elements_by_tag_name("iframe")[0])
        """
        if isinstance(frame_reference, basestring) and self._driver.w3c:
            try:
                frame_reference = self._driver.find_element(By.ID, frame_reference)
            except NoSuchElementException:
                try:
                    frame_reference = self._driver.find_element(By.NAME, frame_reference)
                except NoSuchElementException:
                    raise NoSuchFrameException(frame_reference)

        self._driver.execute(Command.SWITCH_TO_FRAME, {'id': frame_reference})
项目:presentationTool    作者:longfangsong    | 项目源码 | 文件源码
def check_basic_ui(self):
        # ?????????
        try:
            self.browser.find_element_by_id('control-panel')
        except NoSuchElementException:
            self.fail('Please add a control panel')
            # ?????????
        try:
            self.browser.find_element_by_id('presentation-name')
        except NoSuchElementException:
            self.fail('Please add a presentation-name input')
        # ?????demo?????
        try:
            self.browser.switch_to.frame('impress-frame')
            self.browser.switch_to.parent_frame()
        except NoSuchFrameException:
            self.fail('Please add a impress-frame')
项目:devsecops-example-helloworld    作者:boozallen    | 项目源码 | 文件源码
def __call__(self, driver):
        try:
            if isinstance(self.frame_locator, tuple):
                driver.switch_to.frame(_find_element(driver,
                                                     self.frame_locator))
            else:
                driver.switch_to.frame(self.frame_locator)
            return True
        except NoSuchFrameException:
            return False
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def __call__(self, driver):
        try:
            if isinstance(self.frame_locator, tuple):
                driver.switch_to.frame(_find_element(driver,
                                                     self.frame_locator))
            else:
                driver.switch_to.frame(self.frame_locator)
            return True
        except NoSuchFrameException:
            return False
项目:leetcode    作者:thomasyimgit    | 项目源码 | 文件源码
def __call__(self, driver):
        try:
            if isinstance(self.frame_locator, tuple):
                driver.switch_to.frame(_find_element(driver,
                                                     self.frame_locator))
            else:
                driver.switch_to.frame(self.frame_locator)
            return True
        except NoSuchFrameException:
            return False
项目:nerodia    作者:watir    | 项目源码 | 文件源码
def switch(self):
        try:
            self.driver.switch_to.frame(self.el)
            self.browser.default_context = False
        except NoSuchFrameException as e:
            raise UnknownFrameException(e)
项目:ShuoshuoMonitor    作者:aploium    | 项目源码 | 文件源码
def __call__(self, driver):
        try:
            if isinstance(self.frame_locator, tuple):
                driver.switch_to.frame(_find_element(driver,
                                                     self.frame_locator))
            else:
                driver.switch_to.frame(self.frame_locator)
            return True
        except NoSuchFrameException:
            return False
项目:amazon_order_history_scraper    作者:drewctate    | 项目源码 | 文件源码
def __call__(self, driver):
        try:
            if isinstance(self.frame_locator, tuple):
                driver.switch_to.frame(_find_element(driver,
                                                     self.frame_locator))
            else:
                driver.switch_to.frame(self.frame_locator)
            return True
        except NoSuchFrameException:
            return False
项目:webapp    作者:superchilli    | 项目源码 | 文件源码
def __call__(self, driver):
        try:
            if isinstance(self.frame_locator, tuple):
                driver.switch_to.frame(_find_element(driver,
                                                     self.frame_locator))
            else:
                driver.switch_to.frame(self.frame_locator)
            return True
        except NoSuchFrameException:
            return False