本文整理汇总了Python中marionette_driver.Wait类的典型用法代码示例。如果您正苦于以下问题:Python Wait类的具体用法?Python Wait怎么用?Python Wait使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Wait类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: tap_call_button
def tap_call_button(self, switch_to_call_screen=True):
element = Wait(self.marionette).until(
expected.element_present(*self._call_bar_locator))
Wait(self.marionette).until(expected.element_enabled(element))
element.tap()
if switch_to_call_screen:
return CallScreen(self.marionette)
开发者ID:AaskaShah,项目名称:gaia,代码行数:7,代码来源:keypad.py
示例2: tap_export_to_sim
def tap_export_to_sim(self):
export_to_sim = Wait(self.marionette).until(
expected.element_present(*self._export_to_sim_button_locator))
Wait(self.marionette).until(expected.element_displayed(export_to_sim))
export_to_sim.tap()
select_contacts = self.marionette.find_element(*self._select_contacts_locator)
Wait(self.marionette).until(lambda m: select_contacts.location['y'] == 0)
开发者ID:AaskaShah,项目名称:gaia,代码行数:7,代码来源:settings_form.py
示例3: tap_delete_contacts
def tap_delete_contacts(self):
delete_contacts = Wait(self.marionette).until(
expected.element_present(*self._delete_contacts_locator))
Wait(self.marionette).until(expected.element_displayed(delete_contacts))
delete_contacts.tap()
select_contacts = self.marionette.find_element(*self._select_contacts_locator)
Wait(self.marionette).until(lambda m: select_contacts.location['y'] == 0)
开发者ID:AaskaShah,项目名称:gaia,代码行数:7,代码来源:settings_form.py
示例4: tap_done
def tap_done(self):
done = Wait(self.marionette).until(expected.element_present(*self._done_locator))
Wait(self.marionette).until(expected.element_displayed(done))
done.tap()
view = self.marionette.find_element(*self._alarm_view_locator)
Wait(self.marionette).until(lambda m: view.location['x'] == view.size['width'])
return Clock(self.marionette)
开发者ID:AaskaShah,项目名称:gaia,代码行数:7,代码来源:alarm.py
示例5: _search_ad_duration
def _search_ad_duration(self):
"""
Try and determine ad duration. Refreshes state.
:return: ad duration in seconds, if currently displayed in player
"""
self._refresh_state()
if not (self._last_seen_player_state.player_ad_playing or
self._player_measure_progress() == 0):
return None
if (self._last_seen_player_state.player_ad_playing and
self._last_seen_video_state.duration):
return self._last_seen_video_state.duration
selector = '.html5-video-player .videoAdUiAttribution'
wait = Wait(self.marionette, timeout=5)
try:
with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
wait.until(expected.element_present(By.CSS_SELECTOR,
selector))
countdown = self.marionette.find_element(By.CSS_SELECTOR,
selector)
ad_time = self._time_pattern.search(countdown.text)
if ad_time:
ad_minutes = int(ad_time.group('minute'))
ad_seconds = int(ad_time.group('second'))
return 60 * ad_minutes + ad_seconds
except (TimeoutException, NoSuchElementException):
self.marionette.log('Could not obtain '
'element: {}'.format(selector),
level='WARNING')
return None
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:31,代码来源:youtube_puppeteer.py
示例6: deactivate_autoplay
def deactivate_autoplay(self):
"""
Attempt to turn off autoplay. Return True if successful.
"""
element_id = 'autoplay-checkbox'
mn = self.marionette
wait = Wait(mn, timeout=10)
def get_status(el):
script = 'return arguments[0].wrappedJSObject.checked'
return mn.execute_script(script, script_args=[el])
try:
with mn.using_context('content'):
# the width, height of the element are 0, so it's not visible
wait.until(expected.element_present(By.ID, element_id))
checkbox = mn.find_element(By.ID, element_id)
# Note: in some videos, due to late-loading of sidebar ads, the
# button is rerendered after sidebar ads appear & the autoplay
# pref resets to "on". In other words, if you click too early,
# the pref might get reset moments later.
sleep(1)
if get_status(checkbox):
mn.execute_script('return arguments[0].'
'wrappedJSObject.click()',
script_args=[checkbox])
self.marionette.log('Toggled autoplay.')
autoplay = get_status(checkbox)
self.marionette.log('Autoplay is %s' % autoplay)
return (autoplay is not None) and (not autoplay)
except (NoSuchElementException, TimeoutException):
return False
开发者ID:kilikkuo,项目名称:gecko-dev,代码行数:33,代码来源:youtube_puppeteer.py
示例7: connect_to_network
def connect_to_network(self, network_info):
# Wait for the networks to be found
this_network_locator = ("xpath", "//li/a/span[text()='%s']" % network_info["ssid"])
this_network = Wait(self.marionette).until(expected.element_present(*this_network_locator))
this_network.tap()
if network_info.get("keyManagement"):
password = network_info.get("psk") or network_info.get("wep")
if not password:
raise Exception("No psk or wep key found in testvars for secured wifi network.")
screen_width = int(self.marionette.execute_script("return window.innerWidth"))
ok_button = self.marionette.find_element(*self._password_ok_button_locator)
Wait(self.marionette).until(lambda m: (ok_button.location["x"] + ok_button.size["width"]) == screen_width)
password_input = self.marionette.find_element(*self._password_input_locator)
Wait(self.marionette).until(expected.element_displayed(password_input))
password_input.send_keys(password)
ok_button.tap()
connected_message = self.marionette.find_element(*self._connected_message_locator)
self.marionette.execute_script("arguments[0].scrollIntoView(false);", [connected_message])
timeout = max(self.marionette.timeout and self.marionette.timeout / 1000, 60)
Wait(self.marionette, timeout, ignored_exceptions=StaleElementException).until(
lambda m: m.find_element(*self._connected_message_locator).text == "Connected"
)
开发者ID:nullaus,项目名称:gaia,代码行数:26,代码来源:wifi.py
示例8: tap_new_alarm
def tap_new_alarm(self):
new_alarm = Wait(self.marionette).until(
expected.element_present(*self._alarm_create_new_locator))
Wait(self.marionette).until(expected.element_displayed(new_alarm))
new_alarm.tap()
from gaiatest.apps.clock.regions.alarm import NewAlarm
return NewAlarm(self.marionette)
开发者ID:DouglasSherk,项目名称:gaia,代码行数:7,代码来源:app.py
示例9: tap_order_by_last_name
def tap_order_by_last_name(self):
last_name = Wait(self.marionette).until(
expected.element_present(*self._order_by_last_name_switch_locator))
Wait(self.marionette).until(expected.element_displayed(last_name))
initial_state = self.is_custom_element_checked(last_name)
last_name.tap()
self.wait_for_custom_element_checked_state(last_name, checked=not(initial_state))
开发者ID:behappycc,项目名称:b2g-monkey,代码行数:7,代码来源:settings_form.py
示例10: go_back
def go_back(self):
element = Wait(self.marionette).until(expected.element_present(*self._header_locator))
Wait(self.marionette).until(expected.element_displayed(element))
# TODO: replace this hard coded value with tap on the back button, after Bug 1061698 is fixed
element.tap(x=10)
Wait(self.marionette).until(lambda m: m.execute_script(
"return window.wrappedJSObject.Settings && window.wrappedJSObject.Settings._currentPanel === '#root'"))
开发者ID:AaskaShah,项目名称:gaia,代码行数:7,代码来源:language.py
示例11: _switch_to_fxa_iframe
def _switch_to_fxa_iframe(self):
self.marionette.switch_to_frame()
iframe = Wait(self.marionette, timeout=60).until(
expected.element_present(*self._fxa_iframe_locator))
Wait(self.marionette).until(expected.element_displayed(iframe))
Wait(self.marionette, timeout=60).until(lambda m: iframe.get_attribute('data-url') != 'about:blank')
self.marionette.switch_to_frame(iframe)
开发者ID:nvcken,项目名称:gaia,代码行数:7,代码来源:fxaccounts.py
示例12: __init__
def __init__(self, marionette):
Base.__init__(self, marionette)
self.switch_to_frame()
# wait for the page to load
email = Wait(self.marionette).until(
expected.element_present(*self._email_locator))
Wait(self.marionette).until(lambda m: email.get_attribute('value') != '')
开发者ID:AaskaShah,项目名称:gaia,代码行数:7,代码来源:google.py
示例13: tap_confirm_delay
def tap_confirm_delay(self):
element = Wait(self.marionette).until(
expected.element_present(*self._confirm_delay_change_locator))
Wait(self.marionette).until(expected.element_displayed(element))
element.tap()
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(expected.element_displayed(*self._delay_locator))
开发者ID:Archaeopteryx,项目名称:gaia,代码行数:7,代码来源:accessibility.py
示例14: tap_confirm
def tap_confirm(self):
# TODO add a good wait here when Bug 1008961 is resolved
time.sleep(1)
self.marionette.switch_to_frame()
confirm = Wait(self.marionette).until(expected.element_present(*self._confirm_install_button_locator))
Wait(self.marionette).until(expected.element_displayed(confirm))
confirm.tap()
开发者ID:behappycc,项目名称:b2g-monkey,代码行数:7,代码来源:confirm_install.py
示例15: attempt_ad_skip
def attempt_ad_skip(self):
"""
Attempt to skip ad by clicking on skip-add button.
Return True if clicking of ad-skip button occurred.
"""
# Wait for ad to load and become skippable
if self.ad_playing:
self.marionette.log('Waiting while ad plays')
sleep(10)
else:
# no ad playing
return False
if self.ad_skippable:
selector = '#movie_player .videoAdUiSkipContainer'
wait = Wait(self.marionette, timeout=30)
try:
with self.marionette.using_context('content'):
wait.until(expected.element_displayed(By.CSS_SELECTOR,
selector))
ad_button = self.marionette.find_element(By.CSS_SELECTOR,
selector)
ad_button.click()
self.marionette.log('Skipped ad.')
return True
except (TimeoutException, NoSuchElementException):
self.marionette.log('Could not obtain '
'element: %s' % selector,
level='WARNING')
return False
开发者ID:kilikkuo,项目名称:gecko-dev,代码行数:29,代码来源:youtube_puppeteer.py
示例16: __init__
def __init__(self, marionette):
Base.__init__(self, marionette)
self.wait_to_be_displayed()
self.apps.switch_to_displayed_app()
element = Wait(self.marionette).until(
expected.element_present(*self._panel_conversationview_locator))
Wait(self.marionette).until(lambda m: element.rect['x'] == 0 and element.is_displayed())
开发者ID:DouglasSherk,项目名称:gaia,代码行数:7,代码来源:new_message.py
示例17: search_ad_duration
def search_ad_duration(self):
"""
:return: ad duration in seconds, if currently displayed in player
"""
if not (self.ad_playing or self.player_measure_progress() == 0):
return None
# If the ad is not Flash...
if (self.ad_playing and self.video_src.startswith('mediasource') and
self.duration):
return self.duration
selector = '#movie_player .videoAdUiAttribution'
wait = Wait(self.marionette, timeout=5)
try:
with self.marionette.using_context('content'):
wait.until(expected.element_present(By.CSS_SELECTOR,
selector))
countdown = self.marionette.find_element(By.CSS_SELECTOR,
selector)
ad_time = self._time_pattern.search(countdown.text)
if ad_time:
ad_minutes = int(ad_time.group('minute'))
ad_seconds = int(ad_time.group('second'))
return 60 * ad_minutes + ad_seconds
except (TimeoutException, NoSuchElementException):
self.marionette.log('Could not obtain '
'element: %s' % selector,
level='WARNING')
return None
开发者ID:kilikkuo,项目名称:gecko-dev,代码行数:28,代码来源:youtube_puppeteer.py
示例18: test_camera_video
def test_camera_video(self):
"""https://moztrap.mozilla.org/manage/case/1296/"""
lock_screen = LockScreen(self.marionette)
homescreen = lock_screen.unlock()
#self.wait_for_condition(lambda m: self.apps.displayed_app.name == homescreen.name)
# Turn off the geolocation prompt, and then launch the camera app
self.apps.set_permission('Camera', 'geolocation', 'deny')
self.camera = Camera(self.marionette)
self.camera.launch()
while (self.camera.current_flash_mode != 'off'):
self.camera.tap_toggle_flash_button();
time.sleep(2)
time.sleep(5)
self.camera.tap_switch_source()
time.sleep(5)
self.marionette.switch_to_frame()
camera_frame = Wait(self.marionette, timeout=120).until(
expected.element_present(*self._camera_frame_locator))
camera_frame.tap()
self.marionette.switch_to_frame(camera_frame)
self.camera.tap_capture()
print ""
print "Running Camera Video Test"
self.runPowerTest("camera_video", "Camera", "camera")
self.camera.tap_capture()
开发者ID:JonHylands,项目名称:power-tests,代码行数:29,代码来源:test_camera.py
示例19: enable_passcode_lock
def enable_passcode_lock(self):
checkbox = Wait(self.marionette).until(
expected.element_present(*self._passcode_checkbox_locator))
Wait(self.marionette).until(expected.element_displayed(checkbox))
checkbox.tap()
section = self.marionette.find_element(*self._screen_lock_passcode_section_locator)
Wait(self.marionette).until(lambda m: section.location['x'] == 0)
开发者ID:DouglasSherk,项目名称:gaia,代码行数:7,代码来源:screen_lock.py
示例20: tap_settings
def tap_settings(self):
settings = Wait(self.marionette).until(
expected.element_present(*self._settings_button_locator))
Wait(self.marionette).until(expected.element_displayed(settings))
settings.tap()
from gaiatest.apps.cost_control.regions.settings import Settings
return Settings(self.marionette)
开发者ID:arroway,项目名称:gaia,代码行数:7,代码来源:app.py
注:本文中的marionette_driver.Wait类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论