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


Python ActionChains.double_click方法代码示例

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


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

示例1: select

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import double_click [as 别名]
 def select(self, index):
     """ Sets a ``select`` element to `index` . """
     chain = ActionChains(self._browser)
     chain.double_click(self._root).perform()
     element = self._root.find_elements(By.XPATH, 'select')[0]
     WebDriverWait(self._browser, 5).until(
         lambda browser: element.is_displayed())
     WebDriverWait(self._browser, 5).until(
         lambda browser: element.is_enabled())
     option = element.find_elements(By.XPATH, 'option')[index]
     option.click()
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:13,代码来源:grid.py

示例2: value

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import double_click [as 别名]
 def value(self, value):
     chain = ActionChains(self._browser)
     chain.double_click(self._root).perform()
     element = self._root.find_elements(By.XPATH, 'input')[0]
     WebDriverWait(self._browser, 5).until(
         lambda browser: element.is_displayed())
     WebDriverWait(self._browser, 5).until(
         lambda browser: element.is_enabled())
     if element.get_attribute('value'):
         element.clear()
     time.sleep(0.1)  # Just some pacing.
     element.send_keys(value + Keys.RETURN)
开发者ID:akhi28,项目名称:OpenMDAO-Framework,代码行数:14,代码来源:grid.py

示例3: test_task_C7

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import double_click [as 别名]
 def test_task_C7(self):
     # test_profile_update
     # Task C7.	As a logged in user I want to be able to change my staff number and managers email
     self._login_user()
     self.browser.find_element_by_id('id_account').click()
     self.assertTrue(WebDriverWait(self.browser, 10).until(ec.title_is('Profile')))
     self.browser.find_element_by_id('id_staff_number').send_keys('54321')
     action_chains = ActionChains(self.browser)
     action_chains.double_click(self.browser.find_element_by_id('id_manager_email')).perform()
     self.browser.find_element_by_id('id_manager_email').send_keys(MANAGER2)
     self.browser.find_element_by_id('update_profile_button').click()
     self.assertTrue(WebDriverWait(self.browser, 10).until(ec.title_is('Home')))
开发者ID:brendanoates,项目名称:employeeTimeRecorder,代码行数:14,代码来源:test_task_stories.py

示例4: editor_page

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import double_click [as 别名]
 def editor_page(self, double_click=True, base_type='Component'):
     """ Return :class:`ComponentPage` for this component. """
     chain = ActionChains(self.browser)
     if double_click:
         chain.double_click(self.root).perform()
     else:
         self._context_click('edit_button')
     editor_id = 'CE-%s' % self.pathname.replace('.', '-')
     if base_type == 'Assembly':
         return AssemblyPage(self.browser, self.port, (By.ID, editor_id))
     elif base_type == 'Driver':
         return DriverPage(self.browser, self.port, (By.ID, editor_id))
     else:
         return ComponentPage(self.browser, self.port, (By.ID, editor_id))
开发者ID:Kenneth-T-Moore,项目名称:OpenMDAO-Framework,代码行数:16,代码来源:dataflow.py

示例5: create

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import double_click [as 别名]
    def create(self, tr):
        self.tds = tr.find_elements_by_tag_name('td')

        actions = ActionChains(self.driver)
        actions.move_to_element(self.tds[1])
        actions.double_click()
        actions.send_keys(lorem_ipsum.words(1, False))
        actions.perform()

        actions.move_to_element(self.tds[2])
        actions.double_click()
        actions.perform()

        self.driver.select('select.htSelectEditor', unicode(self.experiment.pk))
        self.driver.click('body')
开发者ID:labrepo,项目名称:LabRepo,代码行数:17,代码来源:seltests.py

示例6: edit_file

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import double_click [as 别名]
 def edit_file(self, filename, dclick=True):
     """ Edit `filename` via double-click or context menu. """
     xpath = "//a[(@path='/%s')]" % filename
     element = WebDriverWait(self.browser, TMO).until(lambda browser: browser.find_element_by_xpath(xpath))
     chain = ActionChains(self.browser)
     for i in range(10):
         try:
             if dclick:
                 chain.double_click(element).perform()
             else:
                 chain.context_click(element).perform()
                 self("file_edit").click()
         except StaleElementReferenceException:
             logging.warning("edit_file: StaleElementReferenceException")
             element = WebDriverWait(self.browser, 1).until(lambda browser: browser.find_element_by_xpath(xpath))
             chain = ActionChains(self.browser)
         else:
             break
开发者ID:hitej,项目名称:meta-core,代码行数:20,代码来源:editor.py

示例7: connect

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import double_click [as 别名]
    def connect(self):
        print 'Spotify Social Network Project'
        print '=============================='

        # Open a broswer and navigate to the Spotify player
        print 'Creating webdriver ...'
        options = webdriver.ChromeOptions()
        options.add_experimental_option("excludeSwitches", 
		["ignore-certificate-errors"]) # Suppress a command-line flag
	self.display.start()
        self.driver = webdriver.Chrome(chrome_options=options, 
		service_args=["--verbose", "--log-path=webdriver.log"])
        self.driver.implicitly_wait(2)

        print 'Navigating to Spotify ...'
        self.driver.get('http://play.spotify.com/')

        # Click the "Already have an account" link
	action_chains = ActionChains(self.driver)
        login = WebDriverWait(self.driver, 10).until(
		EC.element_to_be_clickable((By.ID, 'has-account')))
	action_chains.double_click(login).perform()

        # Type in credentials at the command line to log in Spotiy with Facebook
        fb_login = WebDriverWait(self.driver, 10).until(
		EC.element_to_be_clickable((By.ID, 'fb-login-btn')))
        fb_login.click()
        self.driver.switch_to_window(self.driver.window_handles[1])
        print 'Logging in via Facebook ...'
        email_blank = self.driver.find_element_by_id('email')
        pass_blank  = self.driver.find_element_by_id('pass')
        input_email = raw_input('Email or Phone: ')
        input_pass  = getpass.getpass('      Password: ')
        email_blank.send_keys(input_email)
        pass_blank.send_keys(input_pass)
        email_blank.submit()

        # Navigate from the browse page to the user page
        print 'Waiting for Spotify to load ...'
        self.driver.switch_to_window(self.driver.window_handles[0])
        WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//li[@class='item-profile etched-top has-extra-bottom-row show show show show']")))
        print 'Connection complete ...'
        print '=============================='
开发者ID:Ethanator,项目名称:SpotifySocialNetworkProject,代码行数:45,代码来源:scrapeSpotify.py

示例8: edit_file

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import double_click [as 别名]
 def edit_file(self, filename, dclick=True):
     """ Edit `filename` via double-click or context menu. """
     self("files_tab").click()
     element = self.find_file(filename)
     chain = ActionChains(self.browser)
     if dclick:  # This has had issues...
         for i in range(10):
             try:
                 chain.double_click(element).perform()
             except StaleElementReferenceException:
                 logging.warning("edit_file: StaleElementReferenceException")
                 element = self.find_file(filename, 1)
                 chain = ActionChains(self.browser)
             else:
                 break
     else:
         chain.context_click(element).perform()
         self("file_edit").click()
     self.browser.switch_to_window("Code Editor")
     return EditorPage.verify(self.browser, self.port)
开发者ID:RacerXFD,项目名称:OpenMDAO-Framework,代码行数:22,代码来源:workspace.py

示例9: editor_page

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import double_click [as 别名]
 def editor_page(self, double_click=True, base_type='Component',
                 version=ComponentPage.Version.OLD):
     """ Return :class:`ComponentPage` for this component. """
     chain = ActionChains(self.browser)
     if double_click:
         chain.double_click(self.root).perform()
     else:
         self._context_click('edit_button')
     editor_id = 'ObjectFrame_%s' % self.pathname.replace('.', '-')
     chain.release(None).perform()
     if base_type == 'Assembly':
         return AssemblyPage(self.browser, self.port, (By.ID, editor_id))
     elif base_type == 'Driver':
         return DriverPage(self.browser, self.port, (By.ID, editor_id))
     elif base_type == 'ImplicitComponent':
         return ImplicitComponentPage(self.browser, self.port, (By.ID, editor_id),
                              version=version)
     else:
         return ComponentPage(self.browser, self.port, (By.ID, editor_id),
                              version=version)
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:22,代码来源:dataflow.py

示例10: view_geometry

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import double_click [as 别名]
 def view_geometry(self, filename, dclick=True):
     """ View geometry `filename` via double-click or context menu. """
     self('files_tab').click()
     element = self.find_file(filename)
     chain = ActionChains(self.browser)
     if dclick:  # This has had issues...
         for i in range(10):
             try:
                 chain.double_click(element).perform()
             except StaleElementReferenceException:
                 logging.warning('edit_file: StaleElementReferenceException')
                 element = self.find_file(filename, 1)
                 chain = ActionChains(self.browser)
             else:
                 break
     else:
         chain.context_click(element).perform()
         self('file_geometry').click()
     self.browser.switch_to_window(self.browser.window_handles[-1])
     return GeometryPage.verify(self.browser, self.port)
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:22,代码来源:workspace.py

示例11: test_drw_3_1_5

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import double_click [as 别名]

#.........这里部分代码省略.........
                    self.fail("Dreaded third alert, which I can't handle - try running the test again")
                interaction.switchBack()
            except TimeoutException:
                # Normal execution with no alerts (or only the first) should
                # end up here
                pass

            # Select draw polygon
            polygonButton = self.portal.wait(60).until(
                expected_conditions.presence_of_element_located(
                    (By.CSS_SELECTOR, "div.mapControl.polygonDeactivated")
                    )
                )
            polygonButton.click()

            # Get size of map view
            mapViewPortElement = self.portal.wait(10).until(
                expected_conditions.presence_of_element_located(
                    (By.ID, "OpenLayers.Map_12_OpenLayers_ViewPort")
                    )
                )
            mapHeight = mapViewPortElement.size['height']
            mapWidth = mapViewPortElement.size['width']

            with open('file0.html', 'wt') as f:
                f.write(self.portal.page_source)

            # Define the points where we are going to click to make the polygon
            points = [(0.45, 0.5), (0.42, 0.7), (0.53, 0.9), (0.55, 0.5)]

            # Draw the polygon
            (prevX, prevY) = points.pop(0)
            chain = ActionChains(self.portal.browser).move_to_element_with_offset(
                mapViewPortElement, int(prevX*mapWidth), int(prevY*mapHeight)
                )
            for (x, y) in points:
                chain = chain.click().move_by_offset(
                    int((x-prevX)*mapWidth), int((y-prevY)*mapHeight)
                    )
                prevX = x
                prevY = y
            chain.double_click().perform()
            time.sleep(5)
            self.screenshot('screen-drw-14a', interaction.location, interaction.size)

            # Filter elements inside polygon
            filterButton = self.portal.wait(30).until(
                expected_conditions.presence_of_element_located(
                    (By.ID, "smallButton filter")
                    )
                )
            self.pause(1)
            filterButton.click()

            # We cheat a little here. Removing the layers is tricky using
            # Selenium because the 'no overlay' option is not visible on many
            # displays. Scrolling a menu created using a div and CSS is hard,
            # so we reverse the order of the screenshots to get what we need
            time.sleep(5)
            self.screenshot('screen-drw-15a', interaction.location, interaction.size)

            dropdown = self.portal.find_element_by_xpath('//div[@id="mapContainerDiv"]//div[@title="Select layer for spatial filtering"]')
            self.pause(1)
            dropdown.click()

            menuItem = dropdown.find_element_by_xpath('..//dt[text()="ETOPO1 Global Relief Model"]')
            self.pause(1)
            menuItem.click()

            # For screenshot, we let the layer load, and then open the menu again
            time.sleep(5)
            dropdown.click()
            time.sleep(1)
            self.screenshot('screen-drw-14b', interaction.location, interaction.size)

            # Click ok to save changes and go back to subworkflow chooser
            bioStifSaveButton = self.portal.wait(10).until(
                expected_conditions.presence_of_element_located(
                    (By.ID, "user_ok")
                    )
                )
            bioStifSaveButton.click()

        # Choose Sub-workflow
        with run.waitForInteraction(300):
            continueButton = self.portal.wait(60).until(
                expected_conditions.element_to_be_clickable((By.XPATH, '//button/div[text()="OK"]')))
            title = self.portal.find_element_by_xpath('/html/body/table/tbody/tr[1]/td/div').text
            self.assertEqual(title, 'Choose Sub-Workflow')
            input = self.portal.find_element_by_xpath('//label[text()="End Workflow"]/../input')
            self.pause(1)
            input.click()
            self.pause(1)
            self.portal.click(continueButton)

        results = run.waitForFinish(120)

        csv_output = results['csv_output'].getValue()
        count = csv_output.count('\n')
        print(count)
开发者ID:BioVeL,项目名称:portal-tests,代码行数:104,代码来源:tutorial_DRW_A.py

示例12: print

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import double_click [as 别名]
print '\n',"driver.find_element_by_class_name('content')"
print content

content = driver.find_element_by_css_selector('p.content')
print '\n',"driver.find_element_by_css_selector('p.content')"
print content


element = driver.find_element_by_xpath("//form[@id='loginForm']")
all_options = element.find_elements_by_tag_name("input")
for option in all_options:
	print("Value is: %s" % option.get_attribute("name"))
	# option.send_keys(option.get_attribute("name"))
	t = option.get_attribute("type")
	if t == 'Login' or t == 'Clear' :
		print (t)
		option.click()
	if option.get_attribute("name") == 'username':
		option.send_keys('source')


element = driver.find_element_by_class_name('content')
target = driver.find_element_by_name("username1")
print element.text

from selenium.webdriver import ActionChains
action_chains = ActionChains(driver)
action_chains.double_click(element).drag_and_drop(element, target).perform()


# driver.quit()
开发者ID:xiaolongbjcp,项目名称:learnselenium,代码行数:33,代码来源:ex1_locator.py

示例13: test_create_article

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import double_click [as 别名]
    def test_create_article(self):

        article = self.driver.find_element_by_class_name("icon-pencil").click()
        action = Ac(self.driver)
        action.move_to_element(article)
        action.double_click(article).perform()
开发者ID:DaniilBorodin,项目名称:at,代码行数:8,代码来源:3.py

示例14: test_storymap

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import double_click [as 别名]
    def test_storymap(self):
        factories.UserFactory.create(
            email="[email protected]",
            password="123",
            is_staff=True,
        )
        self._login("[email protected]", "123")
        time.sleep(0.2)
        storymap = factories.StoryMapFactory.create()
        self.browser.get(self.live_reverse("storymap_detail",
                                           args=(storymap.pk,)))
        time.sleep(0.2)
        # Create 2 themes
        for seq in range(2):
            self.sel_query("a.create_theme").click()
            time.sleep(0.2)
            theme_input = self.sel_query("#theme-create-panel textarea")
            theme_input.send_keys("Theme {0}".format(seq))
            self.sel_query("#create-theme-btn").click()
            time.sleep(0.5)
        # Create 2 phase
        for seq in range(2):
            self.sel_query("a.create_phase").click()
            time.sleep(0.2)
            theme_input = self.sel_query("#phase-create-panel textarea")
            theme_input.send_keys("Phase {0}".format(seq))
            self.sel_query("#create-phase-btn").click()
            time.sleep(0.5)
        # let's move to the theme and phase to display the "new story" button
        actionChains = ActionChains(self.browser)
        actionChains.move_to_element(self.sel_query(".stories-zone"))
        actionChains.perform()
        time.sleep(0.2)
        self.sel_query(".create_story").click()
        time.sleep(0.2)
        actionChains = ActionChains(self.browser)
        actionChains.send_keys("My first story\n")
        actionChains.perform()
        time.sleep(0.2)

        actionChains = ActionChains(self.browser)
        actionChains.move_to_element(self.sel_query(".stories-zone"))
        actionChains.perform()
        time.sleep(0.2)
        self.sel_query(".create_story").click()
        actionChains = ActionChains(self.browser)
        actionChains.send_keys("My second story\n")
        actionChains.perform()
        time.sleep(0.2)

        story = Story.objects.get(title="My first story")
        phase_1 = Phase.objects.get(name="Phase 1")
        theme_0 = Theme.objects.get(name="Theme 0")

        # move story to another phase
        actionChains = ActionChains(self.browser)
        actionChains.drag_and_drop(
            self.sel_query('.story-cell[story-id="{0}"]'.format(story.pk)),
            self.sel_query('.stories-zone[phase-id="{0}"]'.format(phase_1.pk)),
        )
        actionChains.perform()
        time.sleep(0.2)

        storymap = StoryMap.objects.get(pk=storymap.pk)
        self.assertEqual(storymap.themes.all()[0].name, "Theme 0")
        self.assertEqual(storymap.themes.all()[1].name, "Theme 1")
        self.assertEqual(storymap.phases.all()[0].name, "Phase 0")
        self.assertEqual(storymap.phases.all()[1].name, "Phase 1")
        story = Story.objects.get(title="My first story")
        self.assertEqual(story.phase_id, phase_1.pk)
        self.assertEqual(story.theme_id, theme_0.pk)

        # Edit story
        actionChains = ActionChains(self.browser)
        actionChains.double_click(self.sel_query(
            '.story-cell[story-id="{0}"] .story'.format(
                story.pk
            )
        ))
        actionChains.perform()
        actionChains = ActionChains(self.browser)
        actionChains.send_keys("Edited \n")
        actionChains.perform()
        time.sleep(1)

        self.assertTrue(Story.objects.get(title="Edited My first story"))

        # delete theme 1
        theme = Theme.objects.get(name="Theme 1")
        actionChains = ActionChains(self.browser)
        actionChains.move_to_element(self.sel_query(
            '.theme-cell[theme-id="{0}"]'.format(theme.pk)))
        actionChains.click(self.sel_query(
            '.theme-cell[theme-id="{0}"] .delete_theme'.format(theme.pk)))
        actionChains.perform()
        time.sleep(0.2)
        self.sel_query("#confirm-delete-btn").click()
        time.sleep(0.5)

        # delete phase 0
#.........这里部分代码省略.........
开发者ID:mmsepyx,项目名称:facile_backlog,代码行数:103,代码来源:test_storymap.py

示例15: center_dbclick

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import double_click [as 别名]
 def center_dbclick(self):
     center = self.driver.execute_script(GetScripts.getContainerCenter)
     actions = ActionChains(self.driver)
     actions.move_to_element_with_offset(self.element, int(center['x']), int(center['y']))
     actions.double_click().perform()
开发者ID:2gis,项目名称:mapsapi,代码行数:7,代码来源:map.py


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