本文整理汇总了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')