本文整理汇总了Python中marionette_driver.selection.SelectionManager.select_all方法的典型用法代码示例。如果您正苦于以下问题:Python SelectionManager.select_all方法的具体用法?Python SelectionManager.select_all怎么用?Python SelectionManager.select_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marionette_driver.selection.SelectionManager
的用法示例。
在下文中一共展示了SelectionManager.select_all方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _test_minimum_select_one_character
# 需要导入模块: from marionette_driver.selection import SelectionManager [as 别名]
# 或者: from marionette_driver.selection.SelectionManager import select_all [as 别名]
def _test_minimum_select_one_character(self, el, assertFunc,
x=None, y=None):
sel = SelectionManager(el)
original_content = sel.content
words = original_content.split()
self.assertTrue(len(words) >= 1, 'Expect at least one word in the content.')
# Get the location of the selection carets at the end of the content for
# later use.
sel.select_all()
(_, _), (end_caret_x, end_caret_y) = sel.selection_carets_location()
el.tap()
# Goal: Select the first character.
target_content = original_content[0]
if x and y:
# If we got x and y from the arguments, use it as a hint of the
# location of the first word
pass
else:
x, y = self.word_location(el, 0)
self.long_press_on_location(el, x, y)
# Move the right caret to the end of the content.
(caret1_x, caret1_y), (caret2_x, caret2_y) = sel.selection_carets_location()
self.actions.flick(el, caret2_x, caret2_y, end_caret_x, end_caret_y).perform()
# Move the right caret to the position of the left caret.
(caret1_x, caret1_y), (caret2_x, caret2_y) = sel.selection_carets_location()
self.actions.flick(el, caret2_x, caret2_y, caret1_x, caret1_y).perform()
assertFunc(target_content, sel.selected_content)
示例2: _test_move_selection_carets
# 需要导入模块: from marionette_driver.selection import SelectionManager [as 别名]
# 或者: from marionette_driver.selection.SelectionManager import select_all [as 别名]
def _test_move_selection_carets(self, el, assertFunc):
sel = SelectionManager(el)
original_content = sel.content
words = original_content.split()
self.assertTrue(len(words) >= 1, 'Expect at least one word in the content.')
# Goal: Select all text after the first word.
target_content = original_content[len(words[0]):]
# Get the location of the selection carets at the end of the content for
# later use.
el.tap()
sel.select_all()
(_, _), (end_caret_x, end_caret_y) = sel.selection_carets_location()
self.long_press_on_word(el, 0)
# Move the right caret to the end of the content.
(caret1_x, caret1_y), (caret2_x, caret2_y) = sel.selection_carets_location()
self.actions.flick(el, caret2_x, caret2_y, end_caret_x, end_caret_y).perform()
# Move the left caret to the previous position of the right caret.
self.actions.flick(el, caret1_x, caret1_y, caret2_x, caret2_y).perform()
assertFunc(target_content, sel.selected_content)
示例3: test_drag_carets
# 需要导入模块: from marionette_driver.selection import SelectionManager [as 别名]
# 或者: from marionette_driver.selection.SelectionManager import select_all [as 别名]
def test_drag_carets(self, el_id):
self.open_test_html(self._selection_html)
el = self.marionette.find_element(By.ID, el_id)
sel = SelectionManager(el)
original_content = sel.content
words = original_content.split()
self.assertTrue(len(words) >= 1, 'Expect at least one word in the content.')
# Goal: Select all text after the first word.
target_content = original_content[len(words[0]):]
# Get the location of the carets at the end of the content for later
# use.
el.tap()
sel.select_all()
end_caret_x, end_caret_y = sel.second_caret_location()
self.long_press_on_word(el, 0)
# Drag the second caret to the end of the content.
(caret1_x, caret1_y), (caret2_x, caret2_y) = sel.carets_location()
self.actions.flick(el, caret2_x, caret2_y, end_caret_x, end_caret_y).perform()
# Drag the first caret to the previous position of the second caret.
self.actions.flick(el, caret1_x, caret1_y, caret2_x, caret2_y).perform()
self.assertEqual(target_content, sel.selected_content)
示例4: test_drag_swappable_carets
# 需要导入模块: from marionette_driver.selection import SelectionManager [as 别名]
# 或者: from marionette_driver.selection.SelectionManager import select_all [as 别名]
def test_drag_swappable_carets(self, el_id):
self.open_test_html(self._selection_html)
el = self.marionette.find_element(By.ID, el_id)
sel = SelectionManager(el)
original_content = sel.content
words = original_content.split()
self.assertTrue(len(words) >= 1, 'Expect at least one word in the content.')
target_content1 = words[0]
target_content2 = original_content[len(words[0]):]
# Get the location of the carets at the end of the content for later
# use.
el.tap()
sel.select_all()
end_caret_x, end_caret_y = sel.second_caret_location()
self.long_press_on_word(el, 0)
# Drag the first caret to the end and back to where it was
# immediately. The selection range should not be collapsed.
caret1_x, caret1_y = sel.first_caret_location()
self.actions.flick(el, caret1_x, caret1_y, end_caret_x, end_caret_y)\
.flick(el, end_caret_x, end_caret_y, caret1_x, caret1_y).perform()
self.assertEqual(target_content1, sel.selected_content)
# Drag the first caret to the end.
caret1_x, caret1_y = sel.first_caret_location()
self.actions.flick(el, caret1_x, caret1_y, end_caret_x, end_caret_y).perform()
self.assertEqual(target_content2, sel.selected_content)
示例5: _test_move_selection_carets
# 需要导入模块: from marionette_driver.selection import SelectionManager [as 别名]
# 或者: from marionette_driver.selection.SelectionManager import select_all [as 别名]
def _test_move_selection_carets(self, el, assertFunc):
sel = SelectionManager(el)
original_content = sel.content
words = original_content.split()
self.assertTrue(len(words) >= 1, "Expect at least one word in the content.")
# Goal: Select all text after the first word.
target_content = original_content[len(words[0]) :]
# Get the location of the selection carets at the end of the content for
# later use.
el.tap()
sel.select_all()
(_, _), (end_caret_x, end_caret_y) = sel.selection_carets_location()
x, y = self._first_word_location(el)
self._long_press_to_select(el, x, y)
# Move the right caret to the end of the content.
(caret1_x, caret1_y), (caret2_x, caret2_y) = sel.selection_carets_location()
self.actions.flick(el, caret2_x, caret2_y, end_caret_x, end_caret_y).perform()
# Move the left caret to the previous position of the right caret.
self.actions.flick(el, caret1_x, caret1_y, caret2_x, caret2_y).perform()
# Ignore extra spaces at the beginning of the content in comparison.
assertFunc(target_content.lstrip(), sel.selected_content.lstrip())
示例6: _test_minimum_select_one_character
# 需要导入模块: from marionette_driver.selection import SelectionManager [as 别名]
# 或者: from marionette_driver.selection.SelectionManager import select_all [as 别名]
def _test_minimum_select_one_character(self, el):
sel = SelectionManager(el)
original_content = sel.content
words = original_content.split()
self.assertTrue(len(words) >= 1, 'Expect at least one word in the content.')
# Get the location of the carets at the end of the content for later
# use.
sel.select_all()
end_caret_x, end_caret_y = sel.second_caret_location()
el.tap()
# Goal: Select the first character.
target_content = original_content[0]
self.long_press_on_word(el, 0)
# Drag the second caret to the end of the content.
(caret1_x, caret1_y), (caret2_x, caret2_y) = sel.carets_location()
self.actions.flick(el, caret2_x, caret2_y, end_caret_x, end_caret_y).perform()
# Drag the second caret to the position of the first caret.
(caret1_x, caret1_y), (caret2_x, caret2_y) = sel.carets_location()
self.actions.flick(el, caret2_x, caret2_y, caret1_x, caret1_y).perform()
self.assertEqual(target_content, sel.selected_content)