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


Python ActionChains.release方法代码示例

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


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

示例1: _test_drop_on_component_editor_grid

# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import release [as 别名]
def _test_drop_on_component_editor_grid(browser):
    project_dict, workspace_page = startup(browser)

    workspace_page.add_library_item_to_dataflow('openmdao.main.assembly.Assembly', 'top')
    top = workspace_page.get_dataflow_figure('top', '')

    workspace_page.set_library_filter('Assembly')   # put Assembly at top of lib
    assembly = workspace_page.find_library_button('Assembly')

    editor = top.editor_page(double_click=False, base_type='Assembly')
    editor.show_dataflow()

    editor_top = workspace_page.get_dataflow_fig_in_globals('top')

    # sort through these to find the correct 'top'

    chain = ActionChains(browser)
    chain.click_and_hold(assembly)
    chain.move_to_element(editor_top('header').find_element_by_xpath("..")).perform()
    chain.move_by_offset(200, 1).perform()
    chain.release(None).perform()

    # don't bother checking to see if it appeared,
    # the UI box will appear and screw the test if it did

    closeout(project_dict, workspace_page)
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:28,代码来源:test_dragdrop.py

示例2: test_lasso_select

# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import release [as 别名]
def test_lasso_select(output_file_url, selenium):
    plot = generate_plot()

    #limit to one callback on click release
    plot.add_tools(LassoSelectTool(select_every_mousemove=False))

    # Save the plot and start the test
    save(plot)
    selenium.get(output_file_url)
    assert has_no_console_errors(selenium)

    # Drag a lasso selection area around middle point
    canvas = selenium.find_element_by_tag_name('canvas')

    actions = ActionChains(selenium)
    actions.move_to_element_with_offset(canvas, PLOT_DIM * 0.25, PLOT_DIM * 0.25)
    actions.click_and_hold()
    actions.move_by_offset(0, PLOT_DIM * 0.5)
    actions.move_by_offset(PLOT_DIM * 0.5, 0)
    actions.move_by_offset(0, PLOT_DIM * -0.5)
    actions.release()
    actions.perform()

    # Get the alert from box select and assert that the middle item is selected
    alert = selenium.switch_to_alert()
    assert alert.text == 'middle'
开发者ID:ericmjl,项目名称:bokeh,代码行数:28,代码来源:test_tools.py

示例3: move

# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import release [as 别名]
 def move(self, delta_x, delta_y):
     """ Move dialog. """
     chain = ActionChains(self.browser)
     chain.click_and_hold(self('dialog_title').element)
     chain.move_by_offset(delta_x, delta_y)
     chain.release(None)
     chain.perform()
开发者ID:akhi28,项目名称:OpenMDAO-Framework,代码行数:9,代码来源:dialog.py

示例4: setup

# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import release [as 别名]
    def setup(self):
        try:
            button = self.window.find_element_by_link_text("Cone")
        except NoSuchElementException:
            print >>sys.stderr, "fatal error: could not find the 'Cone' button!"
            print >>sys.stderr, "(visit %s to diagnose the problem)" % (url)
            raise vtkwebtest.WebTest.Abort()

        button.click()

        # Wait for the vtkweb process to start (but time out after 10 seconds).
        if not vtkwebtest.wait_with_timeout(delay=0.5, limit=10, criterion=found_viewport(self.window)):
            print >>sys.stderr, "fatal error: timed out while waiting for vtkweb process to start"
            raise vtkwebtest.WebTest.Abort()

        # Grab the viewport element so we know where to put the mouse.
        div = self.window.find_element_by_id("viewport")

        # Click-and-drag on the cone to change its position a bit.
        drag = ActionChains(self.window)
        drag.move_to_element(div)
        drag.click_and_hold()
        drag.move_by_offset(-300, 100)
        drag.release()
        drag.perform()

        # Give the page some time to update the image.
        time.sleep(1)
开发者ID:hafen,项目名称:tangelo,代码行数:30,代码来源:tangelo-vtkweb-test.py

示例5: set_credit_score_range

# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import release [as 别名]
    def set_credit_score_range(self, slider_direction):
        actions = ActionChains(self.driver)
        # Get the pixel width of the slider control
        slider_element = self.driver.find_element_by_xpath(SLIDER)
        slider_width = int(slider_element.get_attribute("scrollWidth"))

        self.logger.info("width: %s" % slider_width)

        element = self.driver.find_element_by_xpath(SLIDER_HANDLE)

        # Move the slider 1/4 of the total width to the right
        if(slider_direction == "right"):
            xOffset = (slider_width/4)
        # Move the slider 1/4 of the total width to the left
        elif(slider_direction == "left"):
            xOffset = (slider_width/-4)
        # Move the slider 1/2 of the total width to the left
        elif(slider_direction == "lowest"):
            xOffset = (slider_width/-2)
        # Move the slider 1/2 of the total width to the right
        elif(slider_direction == "highest"):
            xOffset = (slider_width/2)

        actions.click_and_hold(element)
        actions.move_by_offset(xOffset, 0)
        actions.release()
        actions.perform()
开发者ID:ascott1,项目名称:owning-a-home,代码行数:29,代码来源:rate_checker.py

示例6: i_select_a_highlight_on_the_first_page_of_document

# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import release [as 别名]
def i_select_a_highlight_on_the_first_page_of_document(step, docnum):
    doc = csss('.edit-document')[int(docnum) - 1]
    el = css("canvas.page-image", doc)
    chain = ActionChains(world.browser)
    chain.move_to_element_with_offset(el, 20, 20)
    chain.click_and_hold(None)
    chain.move_by_offset(300, 100)
    chain.release(None)
    chain.perform()
开发者ID:Shidash,项目名称:btb,代码行数:11,代码来源:mod-scans-steps.py

示例7: solve_14

# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import release [as 别名]
def solve_14(event_names):
    image_size = 186
    offsets = [2 * image_size, 2 * image_size, image_size, image_size]
    for event_name, offset in zip(event_names, offsets):
        element = driver.find_element_by_xpath("//li[@data-id='{0}']".format(event_name))
        action_chain = ActionChains(driver)
        action_chain.click_and_hold(element)
        action_chain.move_by_offset(-offset, 0)
        action_chain.release()
        action_chain.perform()
开发者ID:miebster,项目名称:adventurrito,代码行数:12,代码来源:chipotle.py

示例8: isc_test

# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import release [as 别名]
    def isc_test(self):
        pla = platform_get()
        pla.get('/explore')
        pla.wait_new_page("//b[contains(text(), 'Seismic Hazard Data Sets and Models')]",
                          "/explore", strategy="next", timeout=10)

        #  <li>
        #  <a href="/maps/23">
        enter_button = pla.xpath_finduniq(
            "//li/a[@href='/maps/23' and normalize-space(text()) = 'Global "
            "Instrumental Earthquake Catalogue (1900 - 2009)']")
        enter_button.click()
        pla.wait_new_page(enter_button, '/maps/23')

        enter_button = pla.xpath_finduniq(
            "//a[@href='/maps/23/view' and "
            "normalize-space(text()) = 'View Map']")
        enter_button.click()
        pla.wait_new_page(enter_button, '/maps/23/view', timeout=15)

        # <button id="ext-gen159" class=" x-btn-text gxp-icon-getfeatureinfo"
        # type="button">Identify
        enter_button = pla.xpath_finduniq(
            "//button[@type='button' and normalize-space(text())"
            "= 'Identify']", 50)
        enter_button.click()

        action = ActionChains(pla.driver)
        action.move_by_offset(500, 400)
        action.click_and_hold()
        action.move_by_offset(150, 150)
        action.release()
        action.perform()

        time.sleep(3)

        # wait info button will be clicked
        pla.xpath_finduniq(
            "//button[@type='button' and normalize-space(text())"
            "= 'Identify']/../../../../..[contains(concat(' ', @class, ' '),"
            " ' x-btn-pressed ')]", 100)

        tile = pla.xpath_finduniq(
            "//img[contains(@src, 'wms?LAYERS=oqplatform%3Aisc_viewer_measure"
            "&FORMAT=image%2Fpng&TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1"
            "&REQUEST=GetMap&STYLES=&TILED=true&SRS=EPSG%3A900913&BBOX="
            "-10018754.17,0,-5009377.085,5009377.085&WIDTH=256&HEIGHT=256')]",
            50)

        action = ActionChains(pla.driver)
        action.move_to_element_with_offset(tile, 107, 115)
        action.click()
        action.perform()

        pla.xpath_finduniq("//div[text() = '1951-03-19T04:23:00']", 50)
开发者ID:gem,项目名称:oq-platform,代码行数:57,代码来源:isc_test.py

示例9: movePieceToPuzzle

# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import release [as 别名]
def movePieceToPuzzle(_driver, _piece, _GP, _P1, _P2):
    gx1, gy1 = _GP
    x2, y2 = _P1
    #print("Piece Coord : " + str(_P2[0]) + "," + str(_P2[1]))
    # x2 = x2 + _P2[0] - 50
    # y2 = y2 + _P2[1] - 50
    actionChains = ActionChains(_driver)
    actionChains.move_to_element(_piece)
    actionChains.perform()
    actionChains.click_and_hold(_piece)

    xOffset = 0
    yOffset = 0
    speed = 5

    """Slant movement as far as possible."""
    if(gx1 < x2):
        slope = int(round((y2 - gy1) / (x2 - gx1)))
        if(slope > 0):
            slope *= -1
        xOffset = 1 * speed
        while(gx1 <= x2 and gy1 >= y2):
            actionChains.move_by_offset(xOffset, slope * speed)
            gx1 += xOffset
            gy1 += slope * speed
        actionChains.move_by_offset(gx1 - x2, slope * speed)
        gy1 += slope * speed
    elif(gx1 > x2):
        slope = int(round((y2 - gy1) / (x2 - gx1)))
        if(slope > 0):
            slope *= -1
        xOffset = -1 * speed
        while(x2 <= gx1 and gy1 >= y2):
            actionChains.move_by_offset(xOffset, slope * speed)
            gx1 += xOffset
            gy1 += slope * speed
        actionChains.move_by_offset(x2 - gx1, slope * speed)
        gy1 += slope * speed

    #Remaining distance by robotic
    if(gy1 > y2):
        yOffset = -1 * speed
        while(gy1 >= y2):
            actionChains.move_by_offset(0, yOffset)
            gy1 += yOffset
        actionChains.move_by_offset(0, y2 - gy1)
    elif(gy1 < y2):
        yOffset = 1 * speed
        while(gy1 <= y2):
            actionChains.move_by_offset(0, yOffset)
            gy1 += yOffset
        actionChains.move_by_offset(0, gy1 - y2)
    
    actionChains.release()
    actionChains.perform()
开发者ID:gliesefire,项目名称:MyProjects,代码行数:57,代码来源:sampleCollector.py

示例10: klickElement

# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import release [as 别名]
def klickElement(element):
    print("Klikkin elemendil: "+element.text)
    #actionite läbiviija browseri külge
    actions = ActionChains(browser)
    #liigub nupu juurde
    actions.move_to_element(element)
    #vajutab
    actions.click_and_hold()
    #viib läbi eelnevalt kirjeldatud liigutused
    actions.release()
    actions.perform()
开发者ID:dirgni,项目名称:P2kapikud,代码行数:13,代码来源:main.py

示例11: set_freq_to_10

# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import release [as 别名]
def set_freq_to_10(selenium):
    """
    Set the frequency slider to 10%
    """
    ac = ActionChains(selenium)
    el = selenium.find_element_by_xpath('//a[@class="ui-slider-handle ui-state-default ui-corner-all"]')
    ac.move_to_element(el)
    ac.click_and_hold()
    ac.move_by_offset(80, 0)
    ac.release()
    ac.perform()
开发者ID:batsal,项目名称:xbrowse,代码行数:13,代码来源:functional_tests_using_selenium.py

示例12: test_teacher_green_check_icon_is_displayed_for_completed_14814

# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import release [as 别名]
    def test_teacher_green_check_icon_is_displayed_for_completed_14814(self):
        """Green check icon is displayed for completed assignments.

        Steps:
        If the user has more than one course, click on a CC course name
        Click "View Detailed Scores

        Expected Result:
        Green check icon is displayed for completed assignments
        """
        self.ps.test_updates['name'] = 'cc2.08.011' \
            + inspect.currentframe().f_code.co_name[4:]
        self.ps.test_updates['tags'] = ['cc2', 'cc2.08', 'cc2.08.011', '14814']
        self.ps.test_updates['passed'] = False

        # Test steps and verification assertions
        self.teacher.wait.until(
            expect.visibility_of_element_located(
                (By.XPATH, '//a[contains(text(),"View Detailed Scores")]')
            )
        ).click()
        self.teacher.wait.until(
            expect.visibility_of_element_located(
                (By.XPATH, '//span[contains(text(),"Student Scores")]')
            )
        )
        # scroll to find a green checkmark
        assignments = self.teacher.find_all(
            By.XPATH,
            "//span[contains(@aria-describedby,'header-cell-title')]")

        for i in range(len(assignments)//4):
            try:
                self.teacher.find(
                    By.XPATH,
                    '//span[contains(@class,"trig")]' +
                    '//*[contains(@class,"finished")]')
                break
            except (NoSuchElementException, ElementNotVisibleException):
                if i >= (len(assignments)//4)-1:
                    print("completed assignments for this period")
                    raise Exception
                # try to drag scroll bar instead of scrolling
                scroll_bar = self.teacher.find(
                    By.XPATH,
                    '//div[contains(@class,"ScrollbarLayout_faceHorizontal")]')
                actions = ActionChains(self.teacher.driver)
                actions.move_to_element(scroll_bar)
                actions.click_and_hold()
                actions.move_by_offset(50, 0)
                actions.release()
                actions.perform()

        self.ps.test_updates['passed'] = True
开发者ID:openstax,项目名称:test-automation,代码行数:56,代码来源:test_cc2_08_ImprovesScoresReporting.py

示例13: hard_click

# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import release [as 别名]
def hard_click(el):
    """
    Sometimes selenium seems to be unable to properly click.  This is more
    reliable.
    """
    #href = el.get_attribute("href")
    #world.browser.get(href)
    chain = ActionChains(world.browser)
    chain.click_and_hold(el)
    chain.release(None)
    chain.perform()
开发者ID:Shidash,项目名称:btb,代码行数:13,代码来源:btblettuce.py

示例14: drag_element_at_position

# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import release [as 别名]
 def drag_element_at_position(self, element, x, y, dx, dy, mod=None):
     actions = ActionChains(self._driver)
     if mod:
         actions.key_down(mod)
     actions.move_to_element_with_offset(element, x, y)
     actions.click_and_hold()
     actions.move_by_offset(dx, dy)
     actions.release()
     if mod:
         actions.key_up(mod)
     actions.perform()
开发者ID:jakirkham,项目名称:bokeh,代码行数:13,代码来源:bokeh.py

示例15: resize_editor

# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import release [as 别名]
def resize_editor(workspace_page, editor):
    '''ensure that the editor is not covering the library (or else we cannot drag things from it!)'''
    browser = workspace_page.browser

    page_width = browser.get_window_size()['width']
    lib_width = workspace_page('library_tab').find_element_by_xpath('..').size['width']
    lib_position = workspace_page('library_tab').find_element_by_xpath('..').location['x']
    dialog_width = editor('dialog_title').find_element_by_xpath('../..').size['width']
    dialog_position = editor('dialog_title').find_element_by_xpath('../..').location['x']

    # how much overlap do we have?
    overlap = lib_position - (dialog_position + dialog_width)

    if overlap < 0:  # we are overlapping
        # check to see if we have enough room to move out of the way
        if page_width < dialog_width + lib_width:
            # not enough, need to rezize the editor

            # look for the resize handle
            sibblings = editor('dialog_title').find_elements_by_xpath('../../div')
            handle = None
            for sib in sibblings:
                if "ui-resizable-se" in sib.get_attribute('class'):
                    handle = sib

            # do the resizing
            chain = ActionChains(browser)
            chain.click_and_hold(handle)
            chain.move_by_offset(450 - dialog_width, 0).perform()  # we can resize editor down to 425px, any less and we cover drop targets
            chain.click().perform()  # must click because release is not working. why? I do not know.
            chain.release(None).perform()

            # recalculate the overlap
            dialog_width = editor('dialog_title').find_element_by_xpath('../..').size['width']
            dialog_position = editor('dialog_title').find_element_by_xpath('../..').location['x']
            overlap = lib_position - (dialog_position + dialog_width)

        # We are good, move out!
        chain = ActionChains(browser)
        chain.click_and_hold(editor('dialog_title').element)
        chain.move_by_offset(overlap, 0).perform()
        chain.click().perform()  # must click because release is not working. why? I do not know.
        chain.release(None).perform()

        # recalculate the overlap
        dialog_width = editor('dialog_title').find_element_by_xpath('../..').size['width']
        dialog_position = editor('dialog_title').find_element_by_xpath('../..').location['x']
        overlap = lib_position - (dialog_position + dialog_width)

        if overlap < 0:
            # we still have a problem.
            eq(True, False,
                "Could not move or rezise the editor dialog so it is not " \
                "overlapping the library. The browser window is too small")
开发者ID:Kenneth-T-Moore,项目名称:OpenMDAO-Framework,代码行数:56,代码来源:test_dragdrop.py


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