当前位置: 首页>>代码示例>>Python>>正文


Python Browser.wait_for_element_displayed方法代码示例

本文整理汇总了Python中gaiatest.apps.browser.app.Browser.wait_for_element_displayed方法的典型用法代码示例。如果您正苦于以下问题:Python Browser.wait_for_element_displayed方法的具体用法?Python Browser.wait_for_element_displayed怎么用?Python Browser.wait_for_element_displayed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gaiatest.apps.browser.app.Browser的用法示例。


在下文中一共展示了Browser.wait_for_element_displayed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_play_youtube_video

# 需要导入模块: from gaiatest.apps.browser.app import Browser [as 别名]
# 或者: from gaiatest.apps.browser.app.Browser import wait_for_element_displayed [as 别名]
    def test_play_youtube_video(self):
        """Confirm YouTube video playback

        https://moztrap.mozilla.org/manage/case/6073/
        """
        browser = Browser(self.marionette)
        browser.launch()
        browser.go_to_url(self.video_URL, timeout=180)
        browser.switch_to_content()

        # Tap the video container to load the <video> element and start playing
        browser.wait_for_element_displayed(*self._video_container_locator)
        self.marionette.find_element(*self._video_container_locator).tap()

        # Wait HTML5 player to appear
        browser.wait_for_element_displayed(*self._video_element_locator)
        video = self.marionette.find_element(*self._video_element_locator)
        player = HTML5Player(self.marionette, video)

        # Check that video is playing
        player.wait_for_video_loaded()
        self.assertTrue(player.is_video_playing())

        # Pause playback
        player.pause()
        stopped_at = player.current_timestamp
        self.assertFalse(player.is_video_playing())

        # Resume playback
        player.play()
        resumed_at = player.current_timestamp
        self.assertTrue(player.is_video_playing())

        # Ensure that video resumes to play
        # from the place where it was paused
        delay = resumed_at - stopped_at
        self.assertLessEqual(delay, self.acceptable_delay,
                             'video resumed to play not from place where it was paused')
开发者ID:sanjaygouri,项目名称:gaia,代码行数:40,代码来源:test_browser_play_youtube_video.py


注:本文中的gaiatest.apps.browser.app.Browser.wait_for_element_displayed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。