本文整理汇总了Python中marionette.Actions类的典型用法代码示例。如果您正苦于以下问题:Python Actions类的具体用法?Python Actions怎么用?Python Actions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Actions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: double_tap
def double_tap(marionette, wait_for_condition, expected):
testAction = marionette.absolute_url("testAction.html")
marionette.navigate(testAction)
button = marionette.find_element("id", "button1")
action = Actions(marionette)
action.double_tap(button).perform()
wait_for_condition(lambda m: expected in m.execute_script("return document.getElementById('button1').innerHTML;"))
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:7,代码来源:single_finger_functions.py
示例2: 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("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:Andrel322,项目名称:gecko-dev,代码行数:7,代码来源:single_finger_functions.py
示例3: addAppToHomescreen
def addAppToHomescreen(self, p_name):
#
# Pick an app from the apps listed in this group.
#
x = self.UTILS.getElements(DOM.EME.apps, "Apps list", True, 30)
for appLink in x:
if appLink.get_attribute("data-name") == p_name:
from marionette import Actions
actions = Actions(self.marionette)
actions.press(appLink).wait(2).release()
actions.perform()
self.marionette.switch_to_frame()
x = self.UTILS.getElement(DOM.EME.add_app_to_homescreen, "Add app to homescreen button")
x.tap()
#
# Might need to do this again for Geoloc. ...
#
try:
x = self.marionette.find_element(*DOM.EME.add_app_to_homescreen)
x.tap()
except:
pass
# This isn't obvious, but you need to scroll the screen right
# to reset the position for finding the app later, so I'm
# doing it here.
time.sleep(2)
self.UTILS.goHome()
self.UTILS.scrollHomescreenRight()
return True
return False
开发者ID:carlosmartineztoral,项目名称:OWD_TEST_TOOLKIT,代码行数:35,代码来源:addAppToHomescreen.py
示例4: scroll
def scroll(self):
action = Actions(self.marionette)
for page in self.marionette.find_elements(By.CSS_SELECTOR,
'#icongrid > div')[:-1]:
self.logger.debug('Swiping to next page of apps')
action.flick(
page,
page.size['width'] / 100 * 90,
page.size['width'] / 2,
page.size['width'] / 100 * 10,
page.size['width'] / 2, 200).perform()
MarionetteWait(self.marionette, 30).until(
lambda m: page.get_attribute('aria-hidden') or
not page.is_displayed())
for page in reversed(self.marionette.find_elements(
By.CSS_SELECTOR, '#icongrid > div')[1:]):
MarionetteWait(self.marionette, 30).until_not(
lambda m: page.get_attribute('aria-hidden') or
not page.is_displayed())
self.logger.debug('Swiping to previous page of apps')
action.flick(
page,
page.size['width'] / 100 * 10,
page.size['width'] / 2,
page.size['width'] / 100 * 90,
page.size['width'] / 2, 200).perform()
开发者ID:changm,项目名称:b2gperf,代码行数:26,代码来源:b2gperf.py
示例5: scroll
def scroll(self):
action = Actions(self.marionette)
for page in self.marionette.find_elements(By.CSS_SELECTOR, "#icongrid > div")[:-1]:
self.logger.debug("Swiping to next page of apps")
action.flick(
page,
page.size["width"] / 100 * 90,
page.size["width"] / 2,
page.size["width"] / 100 * 10,
page.size["width"] / 2,
200,
).perform()
Wait(self.marionette, timeout=30).until(
lambda m: page.get_attribute("aria-hidden") or not page.is_displayed()
)
for page in reversed(self.marionette.find_elements(By.CSS_SELECTOR, "#icongrid > div")[1:]):
Wait(self.marionette, timeout=30).until(
lambda m: page.is_displayed() or not page.get_attribute("aria-hidden")
)
self.logger.debug("Swiping to previous page of apps")
action.flick(
page,
page.size["width"] / 100 * 10,
page.size["width"] / 2,
page.size["width"] / 100 * 90,
page.size["width"] / 2,
200,
).perform()
开发者ID:rwood-moz,项目名称:b2gperf,代码行数:28,代码来源:b2gperf.py
示例6: wait_with_value
def wait_with_value(marionette, wait_for_condition, expected):
testAction = marionette.absolute_url("testAction.html")
marionette.navigate(testAction)
button = marionette.find_element("id", "button1")
action = Actions(marionette)
action.press(button).wait(0.01).release()
action.perform()
wait_for_condition(lambda m: expected in m.execute_script("return document.getElementById('button1').innerHTML;"))
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:8,代码来源:single_finger_functions.py
示例7: chain_flick
def chain_flick(marionette, wait_for_condition, expected1, expected2):
testAction = marionette.absolute_url("testAction.html")
marionette.navigate(testAction)
button = marionette.find_element("id", "button1")
action = Actions(marionette)
action.flick(button, 0, 0, 0, 200).perform()
wait_for_condition(lambda m: expected1 in m.execute_script("return document.getElementById('button1').innerHTML;"))
wait_for_condition(lambda m: expected2 in m.execute_script("return document.getElementById('buttonFlick').innerHTML;"))
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:8,代码来源:single_finger_functions.py
示例8: 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("id", "button1")
action = Actions(marionette)
action.press(ele).move_by_offset(0,150).move_by_offset(0, 150).release()
action.perform()
wait_for_condition(lambda m: expected1 in m.execute_script("return document.getElementById('button1').innerHTML;"))
wait_for_condition(lambda m: expected2 in m.execute_script("return document.getElementById('button2').innerHTML;"))
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:9,代码来源:single_finger_functions.py
示例9: context_menu
def context_menu(marionette, wait_for_condition, expected1, expected2):
testAction = marionette.absolute_url("testAction.html")
marionette.navigate(testAction)
button = marionette.find_element("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:Andrel322,项目名称:gecko-dev,代码行数:9,代码来源:single_finger_functions.py
示例10: move_element
def move_element(marionette, wait_for_condition, expected1, expected2):
testAction = marionette.absolute_url("testAction.html")
marionette.navigate(testAction)
ele = marionette.find_element("id", "button1")
drop = marionette.find_element("id", "button2")
action = Actions(marionette)
action.press(ele).move(drop).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:Andrel322,项目名称:gecko-dev,代码行数:10,代码来源:single_finger_functions.py
示例11: chain
def chain(marionette, wait_for_condition, expected1, expected2):
testAction = marionette.absolute_url("testAction.html")
marionette.navigate(testAction)
marionette.set_search_timeout(15000)
action = Actions(marionette)
button1 = marionette.find_element("id", "button1")
action.press(button1).perform()
button2 = marionette.find_element("id", "delayed")
wait_for_condition(lambda m: expected1 in m.execute_script("return document.getElementById('button1').innerHTML;"))
action.move(button2).release().perform()
wait_for_condition(lambda m: expected2 in m.execute_script("return document.getElementById('delayed').innerHTML;"))
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:11,代码来源:single_finger_functions.py
示例12: 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("tag name", "html")
button = marionette.find_element("id", "button1")
action = Actions(marionette)
# Press the center of the button with respect to html.
x = button.location['x'] + button.size['width'] / 2.0
y = button.location['y'] + button.size['height'] / 2.0
action.long_press(html, 5, x, y).perform()
wait_for_condition(lambda m: expected in m.execute_script("return document.getElementById('button1').innerHTML;"))
开发者ID:franzks,项目名称:gecko-dev,代码行数:12,代码来源:single_finger_functions.py
示例13: test_19231
class test_19231(GaiaTestCase):
_Description = "[HOME SCREEN] Verify that the user can uninstall a everything.me app through the grid edit mode."
_appName = "Wikipedia"
def setUp(self):
#
# Set up child objects...
#
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.actions = Actions(self.marionette)
self.settings = AppSettings(self)
# self.market = AppMarket(self)
self.eme = AppEverythingMe(self)
#
#
def tearDown(self):
self.UTILS.reportResults()
def test_run(self):
#
# Get a conection.
#
self.UTILS.getNetworkConnection()
self.UTILS.uninstallApp(self._appName)
#
# Get the app.
#
self.eme.launch()
x = self.eme.searchForApp(self._appName)
self.UTILS.TEST(x, "Icon for " + self._appName + " is found.", True)
x = self.UTILS.getElement( ("xpath", DOM.EME.search_result_icon_xpath % self._appName),
self._appName + " icon")
self.actions.press(x).wait(2).release()
self.actions.perform()
self.marionette.switch_to_frame()
x = self.UTILS.getElement(DOM.GLOBAL.modal_ok_button, "OK button")
x.tap()
time.sleep(2)
self.UTILS.goHome()
self.UTILS.uninstallApp(self._appName)
开发者ID:RafaMarquez,项目名称:owd_test_cases,代码行数:53,代码来源:test_19231.py
示例14: test_main
class test_main(GaiaTestCase):
_appName = "Wikipedia"
def setUp(self):
#
# Set up child objects...
#
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.actions = Actions(self.marionette)
self.settings = Settings(self)
self.eme = EverythingMe(self)
def tearDown(self):
self.UTILS.reportResults()
def test_run(self):
#
# Get a conection.
#
self.UTILS.getNetworkConnection()
self.UTILS.uninstallApp(self._appName)
#
# Get the app.
#
self.eme.launch()
x = self.eme.searchForApp(self._appName)
self.UTILS.TEST(x, "Icon for " + self._appName + " is found.", True)
#
# Long-press the app to install it to the homescreen.
#
x = self.UTILS.getElement( ("xpath", DOM.EME.search_result_icon_xpath % self._appName),
self._appName + " icon")
self.actions.press(x).wait(2).release()
self.actions.perform()
self.marionette.switch_to_frame()
x = self.UTILS.getElement(DOM.GLOBAL.modal_ok_button1, "OK button")
x.tap()
time.sleep(2)
self.UTILS.goHome()
self.UTILS.uninstallApp(self._appName)
开发者ID:DSanchezV,项目名称:owd_test_cases,代码行数:50,代码来源:test_26773.py
示例15: scroll_app
def scroll_app(self, app_name):
touch_duration = float(200)
apps = gaiatest.GaiaApps(self.marionette)
#wait up to 30secs for the elements we want to show up
self.marionette.set_search_timeout(30000)
if app_name == 'Homescreen':
action = Actions(self.marionette)
landing_page = self.marionette.find_element('id', 'landing-page')
action.flick(
landing_page,
landing_page.size['width'] / 100 * 90,
landing_page.size['width'] / 2,
landing_page.size['width'] / 100 * 10,
landing_page.size['width'] / 2, touch_duration).perform()
first_page = self.marionette.find_elements('css selector', '.page')[0]
action.flick(
first_page,
first_page.size['width'] / 100 * 10,
first_page.size['width'] / 2,
first_page.size['width'] / 100 * 90,
first_page.size['width'] / 2, touch_duration).perform()
elif app_name == 'Contacts':
name = self.marionette.find_element("css selector", ".contact-item p > strong")
MarionetteWait(self.marionette, 30).until(lambda m: name.is_displayed())
smooth_scroll(self.marionette, name, "y", -1, 5000, scroll_back=False)
elif app_name == 'Browser':
self.marionette.execute_script("return window.wrappedJSObject.Browser.navigate('http://taskjs.org/');", new_sandbox=False)
MarionetteWait(self.marionette, 30).until(lambda m: 'http://taskjs.org/' == m.execute_script('return window.wrappedJSObject.Browser.currentTab.url;', new_sandbox=False))
MarionetteWait(self.marionette, 30).until(lambda m: not m.execute_script('return window.wrappedJSObject.Browser.currentTab.loading;', new_sandbox=False))
# check when the tab's document is ready
tab_frame = self.marionette.execute_script("return window.wrappedJSObject.Browser.currentTab.dom;")
self.marionette.switch_to_frame(tab_frame)
MarionetteWait(self.marionette, 30).until(lambda m: m.execute_script('return window.document.readyState;', new_sandbox=False) == 'complete')
# we have to fire smooth_scroll from the browser app, so let's go back
self.marionette.switch_to_frame()
apps.launch(app_name) # since the app is launched, launch will switch us back to the app frame without relaunching
tab_dom = self.marionette.execute_script("return window.wrappedJSObject.Browser.currentTab.dom;", new_sandbox=False)
smooth_scroll(self.marionette, tab_dom, "y", -1, 5000, scroll_back=True)
elif app_name == 'Email':
email = self.marionette.find_element("class name", "msg-header-author")
MarionetteWait(self.marionette, 30).until(lambda m: email.is_displayed() or not email.get_attribute('hidden'))
emails = self.marionette.find_elements("class name", "msg-header-author")
#we're dynamically adding these elements from a template, and the first one found is blank.
MarionetteWait(self.marionette, 30).until(lambda m: emails[0].get_attribute('innerHTML'))
emails = self.marionette.find_elements("class name", "msg-header-author")
smooth_scroll(self.marionette, emails[0], "y", -1, 2000, scroll_back=True)
开发者ID:rhelmer,项目名称:eddy-lib,代码行数:48,代码来源:b2gperf.py
示例16: 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("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(lambda m: expected in m.execute_script("return document.getElementById('button1').innerHTML;"))
开发者ID:franzks,项目名称:gecko-dev,代码行数:12,代码来源:single_finger_functions.py
示例17: setUp
def setUp(self):
#
# Set up child objects...
#
GaiaTestCase.setUp(self)
self.UTILS = UTILS(self)
self.actions = Actions(self.marionette)
self.settings = Settings(self)
self.eme = EverythingMe(self)
开发者ID:DSanchezV,项目名称:owd_test_cases,代码行数:9,代码来源:test_26773.py
示例18: scroll_app
def scroll_app(self, app_name):
touch_duration = float(200)
#wait up to 30secs for the elements we want to show up
self.marionette.set_search_timeout(30000)
if app_name.lower() == 'homescreen':
action = Actions(self.marionette)
landing_page = self.marionette.find_element('id', 'landing-page')
self.logger.debug('Swiping to first page of apps')
action.flick(
landing_page,
landing_page.size['width'] / 100 * 90,
landing_page.size['width'] / 2,
landing_page.size['width'] / 100 * 10,
landing_page.size['width'] / 2, touch_duration).perform()
first_page = self.marionette.find_elements('css selector', '.page')[0]
self.logger.debug('Swiping back to home screen')
action.flick(
first_page,
first_page.size['width'] / 100 * 10,
first_page.size['width'] / 2,
first_page.size['width'] / 100 * 90,
first_page.size['width'] / 2, touch_duration).perform()
elif app_name.lower() == 'contacts':
name = self.marionette.find_element("css selector", ".contact-item p > strong")
MarionetteWait(self.marionette, 30).until(lambda m: name.is_displayed())
self.logger.debug('Scrolling through contacts')
smooth_scroll(self.marionette, name, "y", -1, 5000, scroll_back=False)
elif app_name.lower() == 'browser':
tab_dom = self.marionette.execute_script("return window.wrappedJSObject.Browser.currentTab.dom;", new_sandbox=False)
self.logger.debug('Scrolling through browser content')
smooth_scroll(self.marionette, tab_dom, "y", -1, 5000, scroll_back=True)
elif app_name.lower() == 'email':
email = self.marionette.find_element("class name", "msg-header-author")
MarionetteWait(self.marionette, 30).until(lambda m: email.is_displayed() or not email.get_attribute('hidden'))
emails = self.marionette.find_elements("class name", "msg-header-author")
#we're dynamically adding these elements from a template, and the first one found is blank.
MarionetteWait(self.marionette, 30).until(lambda m: emails[0].get_attribute('innerHTML'))
emails = self.marionette.find_elements("class name", "msg-header-author")
self.logger.debug('Scrolling through emails')
smooth_scroll(self.marionette, emails[0], "y", -1, 2000, scroll_back=True)
开发者ID:zbraniecki,项目名称:b2gperf,代码行数:42,代码来源:b2gperf.py
示例19: 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
test_html = self.marionette.absolute_url("javascriptPage.html")
self.marionette.navigate(test_html)
self.reporter_element = self.marionette.find_element("id", "keyReporter")
self.reporter_element.click()
self.key_action = Actions(self.marionette)
开发者ID:stormandsun,项目名称:firefox,代码行数:11,代码来源:test_key_actions.py
示例20: test_three_fingers
def test_three_fingers(self):
testTouch = self.marionette.absolute_url("testAction.html")
self.marionette.navigate(testTouch)
start_one = self.marionette.find_element("id", "mozLink")
start_two = self.marionette.find_element("id", "mozLinkStart")
drop_two = self.marionette.find_element("id", "mozLinkEnd")
ele = self.marionette.find_element("id", "mozLinkCopy2")
multi_action = MultiActions(self.marionette)
action1 = Actions(self.marionette)
action2 = Actions(self.marionette)
action3 = Actions(self.marionette)
action1.press(start_one).move_by_offset(0,300).release()
action2.press(ele).wait().wait(5).release()
action3.press(start_two).move(drop_two).wait(2).release()
multi_action.add(action1).add(action2).add(action3).perform()
time.sleep(15)
self.assertEqual("Move", self.marionette.execute_script("return document.getElementById('mozLink').innerHTML;"))
self.assertEqual("End", self.marionette.execute_script("return document.getElementById('mozLinkPos').innerHTML;"))
self.assertTrue(self.marionette.execute_script("return document.getElementById('mozLinkCopy2').innerHTML >= 5000;"))
self.assertTrue(self.marionette.execute_script("return document.getElementById('mozLinkEnd').innerHTML >= 5000;"))
开发者ID:Tripleman,项目名称:mozilla-central,代码行数:20,代码来源:test_multi_finger.py
注:本文中的marionette.Actions类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论