本文整理汇总了Python中marionette_driver.marionette.Actions类的典型用法代码示例。如果您正苦于以下问题:Python Actions类的具体用法?Python Actions怎么用?Python Actions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Actions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: long_press_action
def long_press_action(marionette, wait_for_condition, expected):
testAction = marionette.absolute_url("testAction.html")
marionette.navigate(testAction)
button = marionette.find_element(By.ID, "button1")
action = Actions(marionette)
action.long_press(button, 5).perform()
wait_for_condition_else_raise(marionette, wait_for_condition, expected, "return document.getElementById('button1').innerHTML;")
开发者ID:luke-chang,项目名称:gecko-1,代码行数:7,代码来源:single_finger_functions.py
示例2: send
def send(self, string):
self.switch_to_keyboard()
for val in string:
if ord(val) > 127:
# this would get the right key to long press and switch to the right keyboard
middle_key_val = self._find_key_for_longpress(val.encode("UTF-8"))
self._switch_to_correct_layout(middle_key_val)
# find the key to long press and press it to get the extended characters list
middle_key = self.marionette.find_element(*self._key_locator(middle_key_val))
action = Actions(self.marionette)
action.press(middle_key).wait(1).perform()
# find the targeted extended key to send
key = Wait(self.marionette).until(expected.element_present(*self._key_locator(val)))
Wait(self.marionette).until(expected.element_displayed(key))
action.move(key).release().perform()
else:
# after switching to correct keyboard, tap/click if the key is there
self._switch_to_correct_layout(val)
self._tap(val)
# when we tap on '@' the layout switches to the default keyboard - Bug 996332
if val == "@":
Wait(self.marionette).until(lambda m: self._layout_page == 0)
self.apps.switch_to_displayed_app()
开发者ID:nullaus,项目名称:gaia,代码行数:27,代码来源:app.py
示例3: wait
def wait(marionette, wait_for_condition, expected):
testAction = marionette.absolute_url("testAction.html")
marionette.navigate(testAction)
action = Actions(marionette)
button = marionette.find_element("id", "button1")
action.press(button).wait().release().perform()
wait_for_condition_else_raise(marionette, wait_for_condition, expected, "return document.getElementById('button1').innerHTML;")
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:7,代码来源:single_finger_functions.py
示例4: chain_flick
def chain_flick(marionette, wait_for_condition, expected1, expected2):
testAction = marionette.absolute_url("testAction.html")
marionette.navigate(testAction)
button = marionette.find_element(By.ID, "button1")
action = Actions(marionette)
action.flick(button, 0, 0, 0, 200).perform()
wait_for_condition_else_raise(marionette, wait_for_condition, expected1,"return document.getElementById('button1').innerHTML;")
wait_for_condition_else_raise(marionette, wait_for_condition, expected2,"return document.getElementById('buttonFlick').innerHTML;")
开发者ID:luke-chang,项目名称:gecko-1,代码行数:8,代码来源:single_finger_functions.py
示例5: context_menu
def context_menu(marionette, wait_for_condition, expected1, expected2):
testAction = marionette.absolute_url("testAction.html")
marionette.navigate(testAction)
button = marionette.find_element(By.ID, "button1")
action = Actions(marionette)
action.press(button).wait(5).perform()
wait_for_condition_else_raise(marionette, wait_for_condition, expected1, "return document.getElementById('button1').innerHTML;")
action.release().perform()
wait_for_condition_else_raise(marionette, wait_for_condition, expected2, "return document.getElementById('button1').innerHTML;")
开发者ID:luke-chang,项目名称:gecko-1,代码行数:9,代码来源:single_finger_functions.py
示例6: move_element_offset
def move_element_offset(marionette, wait_for_condition, expected1, expected2):
testAction = marionette.absolute_url("testAction.html")
marionette.navigate(testAction)
ele = marionette.find_element(By.ID, "button1")
action = Actions(marionette)
action.press(ele).move_by_offset(0,150).move_by_offset(0, 150).release()
action.perform()
wait_for_condition_else_raise(marionette, wait_for_condition, expected1, "return document.getElementById('button1').innerHTML;")
wait_for_condition_else_raise(marionette, wait_for_condition, expected2, "return document.getElementById('button2').innerHTML;")
开发者ID:luke-chang,项目名称:gecko-1,代码行数:9,代码来源:single_finger_functions.py
示例7: _flick_to_image
def _flick_to_image(self, direction):
image = self.marionette.find_element(*self._current_image_locator)
action = Actions(self.marionette)
x_start = (image.size['width'] / 100) * (direction == 'next' and 90 or 10)
x_end = (image.size['width'] / 100) * (direction == 'next' and 10 or 90)
y_start = image.size['height'] / 4
y_end = image.size['height'] / 4
action.flick(image, x_start, y_start, x_end, y_end, 200).perform()
Wait(self.marionette).until(
lambda m: abs(image.location['x']) >= image.size['width'])
开发者ID:Anirudh0,项目名称:gaia,代码行数:10,代码来源:fullscreen_image.py
示例8: move_seek_slider
def move_seek_slider(self, offset):
scale = self.marionette.find_element(*self._video_seek_head_locator)
finger = Actions(self.marionette)
finger.press(scale)
finger.move_by_offset(offset, 0)
finger.release()
finger.perform()
开发者ID:adrm,项目名称:gaia,代码行数:7,代码来源:fullscreen_video.py
示例9: chain
def chain(marionette, wait_for_condition, expected1, expected2):
testAction = marionette.absolute_url("testAction.html")
marionette.navigate(testAction)
marionette.timeout.implicit = 15
action = Actions(marionette)
button1 = marionette.find_element(By.ID, "button1")
action.press(button1).perform()
button2 = marionette.find_element(By.ID, "delayed")
wait_for_condition_else_raise(marionette, wait_for_condition, expected1, "return document.getElementById('button1').innerHTML;")
action.move(button2).release().perform()
wait_for_condition_else_raise(marionette, wait_for_condition, expected2, "return document.getElementById('delayed').innerHTML;")
开发者ID:luke-chang,项目名称:gecko-1,代码行数:11,代码来源:single_finger_functions.py
示例10: move_slider
def move_slider(self, slider, dir_x):
scale = self.marionette.find_element(*slider)
finger = Actions(self.marionette)
finger.press(scale)
finger.move_by_offset(dir_x, 0)
finger.release()
finger.perform()
time.sleep(2)
开发者ID:AndersonFurlane,项目名称:gaia,代码行数:8,代码来源:edit_picture_base.py
示例11: long_press_on_xy_action
def long_press_on_xy_action(marionette, wait_for_condition, expected):
testAction = marionette.absolute_url("testAction.html")
marionette.navigate(testAction)
html = marionette.find_element(By.TAG_NAME, "html")
button = marionette.find_element(By.ID, "button1")
action = Actions(marionette)
# Press the center of the button with respect to html.
x = button.rect['x'] + button.rect['width'] / 2.0
y = button.rect['y'] + button.rect['height'] / 2.0
action.long_press(html, 5, x, y).perform()
wait_for_condition_else_raise(marionette, wait_for_condition, expected, "return document.getElementById('button1').innerHTML;")
开发者ID:luke-chang,项目名称:gecko-1,代码行数:12,代码来源:single_finger_functions.py
示例12: switch_keyboard_language
def switch_keyboard_language(self, lang_code):
# TODO At the moment this doesn't work because the UI has changed
# An attempted repair ran into https://bugzilla.mozilla.org/show_bug.cgi?id=779284 (Modal dialog)
keyboard_language_locator = (By.CSS_SELECTOR, ".keyboard-row button[data-keyboard='%s']" % lang_code)
self.switch_to_keyboard()
language_key = self.marionette.find_element(*self._language_key_locator)
action = Actions(self.marionette)
action.press(language_key).wait(1).perform()
target_kb_layout = self.marionette.find_element(*keyboard_language_locator)
action.move(target_kb_layout).release().perform()
self.apps.switch_to_displayed_app()
开发者ID:nullaus,项目名称:gaia,代码行数:13,代码来源:app.py
示例13: _flick_to_image
def _flick_to_image(self, direction):
image = self.marionette.find_element(*self._current_image_locator)
action = Actions(self.marionette)
x_start = (image.size['width'] / 100) * (direction == 'next' and 90 or 10)
x_end = (image.size['width'] / 100) * (direction == 'next' and 10 or 90)
y_start = image.size['height'] / 4
y_end = image.size['height'] / 4
action.flick(image, x_start, y_start, x_end, y_end, 200).perform()
Wait(self.marionette).until(
lambda m: abs(image.location['x']) >= image.size['width'])
# Workaround for bug 1161441, the transitionend event is not firing in this
# case with a Marionette flick action, as opposed to a manual flick action
self.marionette.execute_script("""
arguments[0].dispatchEvent(new CustomEvent("transitionend"));
""", [self.current_image_frame])
开发者ID:AaskaShah,项目名称:gaia,代码行数:15,代码来源:fullscreen_image.py
示例14: press_release
def press_release(marionette, times, wait_for_condition, expected):
testAction = marionette.absolute_url("testAction.html")
marionette.navigate(testAction)
action = Actions(marionette)
button = marionette.find_element(By.ID, "button1")
action.press(button).release()
# Insert wait between each press and release chain.
for _ in range(times-1):
action.wait(0.1)
action.press(button).release()
action.perform()
wait_for_condition_else_raise(marionette, wait_for_condition, expected, "return document.getElementById('button1').innerHTML;")
开发者ID:luke-chang,项目名称:gecko-1,代码行数:12,代码来源:single_finger_functions.py
示例15: __init__
def __init__(self, p_parent):
self.apps = p_parent.apps
self.data_layer = p_parent.data_layer
self.parent = p_parent
self.marionette = p_parent.marionette
self.UTILS = p_parent.UTILS
self.actions = Actions(self.marionette)
开发者ID:owdqa,项目名称:OWD_TEST_TOOLKIT,代码行数:7,代码来源:everythingme.py
示例16: test_run
def test_run(self):
# Launch messages app.
self.messages.launch()
# Create and send a new test message.
self.messages.create_and_send_sms([self.phone_number], self.test_msg)
send_time = self.messages.last_sent_message_timestamp()
msg = self.messages.wait_for_message(send_time=send_time)
self.messages.check_last_message_contents(self.test_msg)
# Tap on edit mode.
edit_btn = self.UTILS.element.getElement(DOM.Messages.edit_messages_icon, "Edit button")
edit_btn.tap()
select_btn = self.UTILS.element.getElement(DOM.Messages.edit_msgs_select_btn, "Select button")
select_btn.tap()
# Long press the email link.
_link = msg.find_element("tag name", "a")
self.actions = Actions(self.marionette)
self.actions.long_press(_link, 2).perform()
# Check the email address is not a link in edit mode.
self.UTILS.element.waitForNotElements(DOM.Messages.header_create_new_contact_btn, "Create new contact button")
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:25,代码来源:test_26977.py
示例17: setUp
def setUp(self):
# Code to execute before every test is running.
super(AccessibleCaretSelectionModeTestCase, self).setUp()
self.carets_tested_pref = "layout.accessiblecaret.enabled"
self.prefs = {"layout.word_select.eat_space_to_next_word": False, self.carets_tested_pref: True}
self.marionette.set_prefs(self.prefs)
self.actions = Actions(self.marionette)
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:7,代码来源:test_accessiblecaret_selection_mode.py
示例18: setUp
def setUp(self):
MarionetteTestCase.setUp(self)
if self.marionette.session_capabilities['platformName'] == 'DARWIN':
self.mod_key = Keys.META
else:
self.mod_key = Keys.CONTROL
self.action = Actions(self.marionette)
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:7,代码来源:test_mouse_action.py
示例19: test_main
class test_main(GaiaTestCase):
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.messages = Messages(self)
self.actions = Actions(self.marionette)
# Establish which phone number to use.
self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
self.incoming_sms_num = self.UTILS.general.get_config_variable("sms_platform_numbers", "common").split(',')
self.UTILS.reporting.logComment("Sending sms to telephone number " + self.phone_number)
self.data_layer.delete_all_sms()
def tearDown(self):
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.statusbar.clearAllStatusBarNotifs()
timestamp = " {}".format(time.time())
sms_message = "0123456789" * 5 + timestamp
self.UTILS.reporting.logComment("Message length sent: {}".format((len(sms_message))))
self.UTILS.messages.create_incoming_sms(self.phone_number, sms_message)
self.UTILS.statusbar.wait_for_notification_toaster_detail(timestamp, timeout=120)
title = self.UTILS.statusbar.wait_for_notification_toaster_with_titles(self.incoming_sms_num, timeout=5)
self.UTILS.statusbar.click_on_notification_title(title, DOM.Messages.frame_locator)
# Open sms option with longtap on it
self.UTILS.reporting.logResult("info", "Open sms option with longtap on it")
sms = self.messages.last_message_in_this_thread()
body = self.marionette.find_element(*DOM.Messages.last_message_body, id=sms.id)
self.actions.long_press(body, 2).perform()
# Press cancel button
self.UTILS.reporting.logResult("info", "Clicking cancel button")
time.sleep(2)
cancel_btn = self.UTILS.element.getElement(DOM.Messages.cancel_btn_msg_opt, "Cancel button is displayed")
self.UTILS.reporting.debug("*** Cancel button: {} text: {}".format(cancel_btn, cancel_btn.text))
self.UTILS.element.simulateClick(cancel_btn)
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:45,代码来源:test_31574.py
示例20: test_main
class test_main(GaiaTestCase):
def __init__(self, *args, **kwargs):
kwargs['restart'] = True
super(test_main, self).__init__(*args, **kwargs)
def setUp(self):
# Set up child objects...
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.settings = Settings(self)
self.EME = EverythingMe(self)
self.actions = Actions(self.marionette)
try:
self.apps.set_permission('Homescreen', 'geolocation', 'deny')
self.apps.set_permission('Smart Collections', 'geolocation', 'deny')
except:
self.UTILS.reporting.logComment("Unable to automatically set geolocation permission.")
def tearDown(self):
# Restart device to restore collections
self.device.restart_b2g()
GaiaTestCase.setUp(self)
self.UTILS.reporting.reportResults()
GaiaTestCase.tearDown(self)
def test_run(self):
self.UTILS.iframe.switchToFrame(*DOM.Home.frame_locator)
categories = self.UTILS.element.getElements(DOM.EME.all_collections, "All collections")
for cat in categories:
name = self.marionette.find_element('css selector', 'span.title', cat.id).text
self.UTILS.reporting.debug("** Removing collection: {}".format(name))
self.actions.long_press(cat, 2).perform()
delete_btn = ("xpath", DOM.Home.app_delete_icon_xpath.format(name))
delete_button = self.UTILS.element.getElement(delete_btn, "Delete button", False, 30, True)
delete_button.tap()
delete = self.UTILS.element.getElement(DOM.Home.app_confirm_delete, "Confirm app delete button")
delete.tap()
self.UTILS.element.waitForNotElements(DOM.EME.all_collections, "All collections", timeout=10)
开发者ID:owdqa,项目名称:owd_test_cases,代码行数:44,代码来源:test_26782.py
注:本文中的marionette_driver.marionette.Actions类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论