當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。