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


Python Actions.wait方法代码示例

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


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

示例1: press_release

# 需要导入模块: from marionette import Actions [as 别名]
# 或者: from marionette.Actions import wait [as 别名]
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,代码行数:14,代码来源:single_finger_functions.py

示例2: long_press_without_contextmenu

# 需要导入模块: from marionette import Actions [as 别名]
# 或者: from marionette.Actions import wait [as 别名]
def long_press_without_contextmenu(marionette_session, element, time_in_seconds, x=None, y=None):
    """
        :param element: The element to press.
        :param time_in_seconds: Time in seconds to wait before releasing the press.
        #x: Optional, x-coordinate to tap, relative to the top-left corner of the element.
        #y: Optional, y-coordinate to tap, relative to the top-leftcorner of the element.
    """
    action = Actions(marionette_session)
    action.press(element, x, y)
    action.move_by_offset(0, 0)
    action.wait(time_in_seconds)
    action.release()
    action.perform()
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:15,代码来源:gestures.py

示例3: TouchCaretTest

# 需要导入模块: from marionette import Actions [as 别名]
# 或者: from marionette.Actions import wait [as 别名]

#.........这里部分代码省略.........
        el.tap()
        sel.move_caret_to_end()
        sel.move_caret_by_offset(1, backward=True)
        el.tap(*sel.caret_location())

        # Move touch caret to the top-left corner of the input box.
        src_x, src_y = sel.touch_caret_location()
        dest_x, dest_y = 0, 0
        self.actions.flick(el, src_x, src_y, dest_x, dest_y).perform()

        el.send_keys(content_to_add)
        assertFunc(target_content, sel.content)

    def _test_touch_caret_timeout_by_dragging_it_to_top_left_corner_after_timout(self, el, assertFunc):
        sel = SelectionManager(el)
        content_to_add = '!'
        non_target_content = content_to_add + sel.content

        # Get touch caret expiration time in millisecond, and convert it to second.
        timeout = self.expiration_time / 1000.0

        # Tap to make touch caret appear. Note: it's strange that when the caret
        # is at the end, the rect of the caret in <textarea> cannot be obtained.
        # A bug perhaps.
        el.tap()
        sel.move_caret_to_end()
        sel.move_caret_by_offset(1, backward=True)
        el.tap(*sel.caret_location())

        # Wait until touch caret disappears, then pretend to move it to the
        # top-left corner of the input box.
        src_x, src_y = sel.touch_caret_location()
        dest_x, dest_y = 0, 0
        self.actions.wait(timeout).flick(el, src_x, src_y, dest_x, dest_y).perform()

        el.send_keys(content_to_add)
        assertFunc(non_target_content, sel.content)

    ########################################################################
    # <input> test cases with touch caret enabled
    ########################################################################
    def test_input_move_caret_to_the_right_by_one_character(self):
        self.openTestHtml(enabled=True, expiration_time=self._large_expiration_time)
        self._test_move_caret_to_the_right_by_one_character(self._input, self.assertEqual)

    def test_input_move_caret_to_end_by_dragging_touch_caret_to_bottom_right_corner(self):
        self.openTestHtml(enabled=True, expiration_time=self._large_expiration_time)
        self._test_move_caret_to_end_by_dragging_touch_caret_to_bottom_right_corner(self._input, self.assertEqual)

    def test_input_move_caret_to_front_by_dragging_touch_caret_to_top_left_corner(self):
        self.openTestHtml(enabled=True, expiration_time=self._large_expiration_time)
        self._test_move_caret_to_front_by_dragging_touch_caret_to_top_left_corner(self._input, self.assertEqual)

    def test_input_touch_caret_timeout(self):
        self.openTestHtml(enabled=True)
        self._test_touch_caret_timeout_by_dragging_it_to_top_left_corner_after_timout(self._input, self.assertNotEqual)

    ########################################################################
    # <input> test cases with touch caret disabled
    ########################################################################
    def test_input_move_caret_to_the_right_by_one_character_disabled(self):
        self.openTestHtml(enabled=False)
        self._test_move_caret_to_the_right_by_one_character(self._input, self.assertNotEqual)

    def test_input_move_caret_to_front_by_dragging_touch_caret_to_top_left_corner_disabled(self):
        self.openTestHtml(enabled=False)
开发者ID:aeddi,项目名称:gecko-dev,代码行数:70,代码来源:test_touchcaret.py


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