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


Python action_builder.ActionBuilder类代码示例

本文整理汇总了Python中selenium.webdriver.common.actions.action_builder.ActionBuilder的典型用法代码示例。如果您正苦于以下问题:Python ActionBuilder类的具体用法?Python ActionBuilder怎么用?Python ActionBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test_context_click

def test_context_click(driver, pages):

    pages.load("javascriptPage.html")
    toContextClick = driver.find_element_by_id("doubleClickField")

    actions = ActionBuilder(driver)
    pointer = actions.pointer_action
    pointer.context_click(toContextClick)

    actions.perform()
    assert "ContextClicked" == toContextClick.get_attribute('value')
开发者ID:juangj,项目名称:selenium,代码行数:11,代码来源:w3c_interaction_tests.py

示例2: test_double_click

def test_double_click(driver, pages):
    """Copied from org.openqa.selenium.interactions.TestBasicMouseInterface."""
    pages.load("javascriptPage.html")
    toDoubleClick = driver.find_element_by_id("doubleClickField")

    actions = ActionBuilder(driver)
    pointer = actions.pointer_action

    pointer.double_click(toDoubleClick)

    actions.perform()
    assert "DoubleClicked" == toDoubleClick.get_attribute('value')
开发者ID:juangj,项目名称:selenium,代码行数:12,代码来源:w3c_interaction_tests.py

示例3: test_move_and_click

def test_move_and_click(driver, pages):
    pages.load("javascriptPage.html")
    toClick = driver.find_element_by_id("clickField")

    actions = ActionBuilder(driver)
    pointer = actions.pointer_action

    pointer.move_to(toClick) \
           .click()

    actions.perform()
    assert "Clicked" == toClick.get_attribute('value')
开发者ID:juangj,项目名称:selenium,代码行数:12,代码来源:w3c_interaction_tests.py

示例4: testSendingKeysToActiveElementWithModifier

def testSendingKeysToActiveElementWithModifier(driver, pages):
    pages.load("formPage.html")
    e = driver.find_element_by_id("working")
    e.click()

    actions = ActionBuilder(driver)
    key_action = actions.key_action
    key_action.key_down(Keys.SHIFT) \
        .send_keys("abc") \
        .key_up(Keys.SHIFT)

    actions.perform()

    assert "ABC" == e.get_attribute('value')
开发者ID:juangj,项目名称:selenium,代码行数:14,代码来源:w3c_interaction_tests.py

示例5: _performDragAndDropWithMouse

def _performDragAndDropWithMouse(driver, pages):
    """Copied from org.openqa.selenium.interactions.TestBasicMouseInterface."""
    pages.load("draggableLists.html")
    dragReporter = driver.find_element_by_id("dragging_reports")
    toDrag = driver.find_element_by_id("rightitem-3")
    dragInto = driver.find_element_by_id("sortable1")

    actions = ActionBuilder(driver)
    pointer = actions.pointer_action
    pointer.click_and_hold(toDrag) \
           .move_to(driver.find_element_by_id("leftitem-4")) \
           .move_to(dragInto) \
           .release()

    assert "Nothing happened." == dragReporter.text

    actions.perform()
    assert "Nothing happened. DragOut" in dragReporter.text
开发者ID:juangj,项目名称:selenium,代码行数:18,代码来源:w3c_interaction_tests.py

示例6: testDragAndDrop

def testDragAndDrop(driver, pages):
    """Copied from org.openqa.selenium.interactions.TestBasicMouseInterface."""
    element_available_timeout = 15
    wait = WebDriverWait(driver, element_available_timeout)
    pages.load("droppableItems.html")
    wait.until(lambda dr: _isElementAvailable(driver, "draggable"))

    if not _isElementAvailable(driver, "draggable"):
        raise AssertionError("Could not find draggable element after 15 seconds.")

    toDrag = driver.find_element_by_id("draggable")
    dropInto = driver.find_element_by_id("droppable")
    actions = ActionBuilder(driver)
    pointer = actions.pointer_action
    pointer.click_and_hold(toDrag) \
           .move_to(dropInto)\
           .release()

    actions.perform()

    dropInto = driver.find_element_by_id("droppable")
    text = dropInto.find_element_by_tag_name("p").text
    assert "Dropped!" == text
开发者ID:juangj,项目名称:selenium,代码行数:23,代码来源:w3c_interaction_tests.py

示例7: test_can_create_pause_action_on_pointer

def test_can_create_pause_action_on_pointer(driver, pages):
    # If we don't get an error and takes less than 3 seconds to run, we are good
    import datetime
    start = datetime.datetime.now()
    actions1 = ActionBuilder(driver)
    key_actions = actions1.pointer_action
    key_actions.pause(1)
    actions1.perform()
    finish = datetime.datetime.now()
    assert (finish - start).seconds <= 3

    # Add a filler step
    actions2 = ActionBuilder(driver)
    key_action = actions2.pointer_action
    key_action.pause()
    actions2.perform()
开发者ID:juangj,项目名称:selenium,代码行数:16,代码来源:w3c_interaction_tests.py

示例8: test_can_clear_actions

def test_can_clear_actions(driver, pages):
    actions = ActionBuilder(driver)
    actions.clear_actions()
开发者ID:juangj,项目名称:selenium,代码行数:3,代码来源:w3c_interaction_tests.py


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