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


Python WebDriverWait.click方法代码示例

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


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

示例1: test_create_quick_new_proposal_for_issue

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import click [as 别名]
    def test_create_quick_new_proposal_for_issue(self):
        self.login(self.u1)
        url = self.full_url(self.community.get_absolute_url())
        self.selenium.get(url)
        self.selenium.find_element_by_xpath('//a[@href="{}main/"]'.format(
            self.community.get_absolute_url())
        ).click()

        # Add a quick issue to the meeting
        self.selenium.find_element_by_xpath(
            '//input[@type="text"]').send_keys("Building a new road")
        self.selenium.find_element_by_xpath('//button[@id="quick-issue-add"]').click()

        # Add a quick proposal to the issue
        button = WebDriverWait(self.selenium, 10).until(
            ec.presence_of_element_located((
                By.LINK_TEXT, 'Building a new road')))
        button.click()
        # self.selenium.find_element_by_link_text("Building a new road").click()
        self.selenium.find_element_by_id("quick-proposal-title").send_keys("New Proposal")
        self.selenium.find_element_by_id("quick-proposal-add").click()

        # Test: If there is a line with text "New Proposal", Its OK.
        time.sleep(0.6)
        self.assertTrue(self.is_element_present(By.XPATH, "//* [contains(text(), 'New Proposal')]"))
开发者ID:Mengo33,项目名称:OpenCommunity,代码行数:27,代码来源:example_live_test.py

示例2: choose_page

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import click [as 别名]
 def choose_page(self, key):
     '''分页操作'''
     pange_number = 15  # 每页展示的数据,默认是15条
     driver = self.conf.driver
     driver.implicitly_wait(10)
     # 获取分页的数量
     xpath = LC.COMMON[key]
     # 页面总数所在的xpath的路径值
     totle = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, xpath))).text
     totles = int(totle)
     print('totles  is :', totles)
     # 计算页数
     pages = int(totles / pange_number)
     sum0 = driver.find_elements_by_xpath(xpath="//tr[@class='ng-scope']")
     sum = len(sum0)
     time.sleep(1)
     i = 0
     for i in range(0, pages):
         # import pdb
         # pdb.set_trace()
         xpath1 = '//*[@id="main-container"]/div[1]/div[2]/div[2]/div/div/div[4]/ul[1]/li[8]/a'
         ele2 = WebDriverWait(driver, 10).until(lambda x: x.find_element_by_xpath(xpath=xpath1))
         ele2.click()
         time.sleep(0.5)
         count0 = driver.find_elements_by_xpath(xpath="//tr[@class='ng-scope']")
         count = len(count0)
         sum = sum + count
         time.sleep(0.5)
         print('sum  is :', sum)
         i = i + 1
     time.sleep(0.5)
     assert sum == totles, "列表总数不正确,分页校验失败"
     print("总条数:%s,页数:%s" % (totles,pages))
     print('列表总数正确,分页校验成功')
开发者ID:hyteer,项目名称:work,代码行数:36,代码来源:common.py

示例3: hide_and_get

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import click [as 别名]
 def hide_and_get(self):
     # hide current menu and get it again
     menu = WebDriverWait(self.driver, 30, 0.1).until(
         lambda d: d.find_element_by_css_selector(self.DROP_MENU_SELECT)
     )
     menu.click()
     menu.click()
开发者ID:govorovsky,项目名称:tech-testing-ha2,代码行数:9,代码来源:Components.py

示例4: test_channelAnimatorBoundaryAnimation

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import click [as 别名]
    def test_channelAnimatorBoundaryAnimation(self):
        driver = self.driver 

        # Open a test image so we have something to animate
        Util.load_image( self, driver, "Default")

        # Find and record the last valid value of the animation
        self._getLastValue( driver, "Channel" )
        lastChannelValue = self._getCurrentValue( driver, "Channel" )

        # Find and click the lower spin box
        lowerBoundText = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@id='ChannelLowerBoundSpin']/input")))
        driver.execute_script( "arguments[0].scrollIntoView(true);", lowerBoundText)
        lowerBoundText.click()

        # Change the lower bound value
        lowerBoundValue = Util._changeElementText(self, driver, lowerBoundText, 1)

        # Find and click the upper spin box
        upperBoundText = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@id='ChannelUpperBoundSpin']/input")))
        driver.execute_script( "arguments[0].scrollIntoView(true);", upperBoundText)
        upperBoundText.click()

        # Change the upper bound value 
        upperBoundValue = Util._changeElementText( self, driver, upperBoundText, int(lastChannelValue)-1)

        # Allow test image to animate for 2 seconds
        self._animateForward( driver, "Channel" )
        time.sleep(2)

        # Check that the lower and upper bound values did not change during animation
        lowerBound = lowerBoundText.get_attribute("value")
        upperBound = upperBoundText.get_attribute("value")
        self.assertEqual( int(lowerBound), int(lowerBoundValue), "Lower bound channel value changed during animation")
        self.assertEqual( int(upperBound), int(upperBoundValue), "Upper bound channel value changed during animation")
开发者ID:durga2112,项目名称:CARTAvis,代码行数:37,代码来源:tAnimatorTapeDeck.py

示例5: upload

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import click [as 别名]
def upload(driver, path):
    elem = WebDriverWait(driver, 30).until(
        EC.visibility_of_element_located((By.CSS_SELECTOR, '#cx-detail-pane input'))
    )
    elem.click()
    print('Entering upload form ...')

    elem = WebDriverWait(driver, 30).until(
        EC.presence_of_element_located((By.CSS_SELECTOR, '#cx-dev-upload-form input'))
    )
    print('...')

    driver.execute_script(
        '(function() {'
        'var input = document.querySelector("#cx-dev-upload-form input");'
        'input.style.visibility="visible";'
        'input.style.position = "initial";'
        'input.style.height = "initial";'
        '})();'
    )
    elem.send_keys(path)
    elem = driver.find_element_by_id('upload-btn')
    elem.click()
    print('Uploading %s ...' % path)

    WebDriverWait(driver, 300).until(lambda x: x.title[-len(EDIT_TITLE):] == EDIT_TITLE)
    print('...')
开发者ID:SparKot,项目名称:foxtrick,代码行数:29,代码来源:cws_upload.py

示例6: get_browser

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import click [as 别名]
def get_browser(username, password):
    """Get an instance of a firefox browser"""

    browser = webdriver.Firefox()
    browser.set_window_size(1020, 800)

    # set username
    browser.get('https://www.cgd.pt')
    elem = WebDriverWait(browser, 10).until(
        EC.presence_of_element_located((By.ID, 'input_cx1'))
    )
    elem.send_keys(username + Keys.ENTER)

    # close warnings
    elem = WebDriverWait(browser, 10).until(
        EC.element_to_be_clickable((By.XPATH, '//*[@title="Fechar Aviso"]'))
    )
    elem.click()

    # add password
    elem = WebDriverWait(browser, 10).until(
        EC.presence_of_element_located((By.ID, 'passwordInput'))
    )
    elem.send_keys(password + Keys.ENTER)

    # close warnings
    elem = WebDriverWait(browser, 10).until(
        EC.element_to_be_clickable((By.CLASS_NAME, 'botao_ok'))
    )
    elem.click()

    return browser
开发者ID:lmagomes,项目名称:misc,代码行数:34,代码来源:cgdcheck.py

示例7: delete_workspace

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import click [as 别名]
    def delete_workspace(self):
        #Don't delete the default "Take the Tour" workspace, just close the workspace
        if self.driver.title == "Take the Tour":
            self.driver.close()
            return True

        #Click on the cog icon and then select the delete workspace option
        what = self.get_xpath("cog_icon")
        cog_icon = WebDriverWait(self.driver, 5).until(EC.element_to_be_clickable((By.XPATH, what)))
        cog_icon.click()
        what = self.get_xpath("delete_workspace")
        delete_button = WebDriverWait(self.driver, 5).until(EC.element_to_be_clickable((By.XPATH, what)))
        delete_button.click()

        #If there are no widgets then clicking the delete workspace option will close the workspace so wait a few seconds for it to close and then switch to the open window
        #(TODO: Figure out a better way to wait for the window to close)
        time.sleep(2)
        self.driver.switch_to_window(self.driver.window_handles[-1])

        #The confirmation page will only appear if there are widgets on the workspace so ignore the timeout if the confimration doesn't appear
        what = self.get_xpath("delete_workspace_confirmation")
        wait = WebDriverWait(self.driver, 5)
        try:
            confirmation_window = wait.until(EC.element_to_be_clickable((By.XPATH, what)))
        except TimeoutException, e:
            return True
开发者ID:joubertvisser,项目名称:jv,代码行数:28,代码来源:Helper_Functions.py

示例8: export_project

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import click [as 别名]
 def export_project(self, project_name):
     """ Clicks the 'export' button. Returns :class:`ExportDialog`. """
     self.search_input = project_name
     element = WebDriverWait(self.browser, TMO).until(
                   lambda browser: browser.find_element_by_link_text(project_name))
     element = element.find_element_by_xpath('../../td[6]/form[2]/button')
     element.click()
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:9,代码来源:project.py

示例9: test_answer_action

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import click [as 别名]
    def test_answer_action(self):
        #self.browser.find_element_by_xpath("(//input[@name='ans'])[2]").click()
        toclick = WebDriverWait(self, 10).until(lambda self : self.browser.find_element_by_xpath("(//input[@name='ans'])[2]"))	
        toclick.click()
        urgency = self.browser.find_element_by_id("userquestion_urgency")
        urgency.send_keys("7")
        importance = self.browser.find_element_by_id("userquestion_importance")
        importance.send_keys("8")
        self.browser.find_element_by_id("userquestion_changecat").click()
    
        category = self.browser.find_element_by_id("userquestion_category")
        category.send_keys("Strategy")
        self.browser.find_element_by_id("userquestion_changescope").click()
        
        #activescope = self.browser.find_element_by_id("userquestion_activescope")
        #activescope.select_by_visible_text("2 Continental")

        #continent = self.browser.find_element_by_id("userquestion_continent")
        #continent.select_by_visible_text("Africa (AF)")

        #self.browser.find_element_by_id("userquestion_answerreason").clear()
        self.browser.find_element_by_id("userquestion_answerreason").send_keys("the right answer selenium testing")
        #driver.find_element_by_css_selector("input.btn").click()        

        #answer.send_keys("1")

        submit_button = self.browser.find_element_by_css_selector("#submit_record__row input")
        submit_button.click()
	time.sleep(2)

        body = self.browser.find_element_by_tag_name('body')
        self.assertIn('This action', body.text)
开发者ID:NewGlobalStrategy,项目名称:NetDecisionMaking,代码行数:34,代码来源:test_answeraction.py

示例10: has_claimed_mulligan

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import click [as 别名]
    def has_claimed_mulligan(self):
        """
        Returns True if the account with self.username and self.password
        has claimed its mulligan, false otherwise
        """
        ## navigate to claim mulligan page
        self._get_make_picks_page()
        more = WebDriverWait(self.browser, 10).until(
            EC.presence_of_element_located((By.CLASS_NAME, "last"))
            )
        more.click()
        button1 = WebDriverWait(self.browser, 10).until(
            EC.presence_of_element_located((By.CLASS_NAME, "bam-button-primary"))
            )
        buttons = self.browser.find_elements_by_class_name('bam-button-primary')
        buttons[3].click()

        ## Check if we've claimed the mulligan
        mulOption = WebDriverWait(self.browser, 10).until(
            EC.presence_of_element_located((By.CLASS_NAME, "mulligan-list")) 
            )
        mulOption.click()
        try:
            claimMul = WebDriverWait(self.browser, 10).until(
                EC.presence_of_element_located((By.CLASS_NAME, 'claim-mulligan-btn')))
        except TimeoutException:
            return True

        return False
开发者ID:frahman5,项目名称:beatthestreakBots,代码行数:31,代码来源:bot.py

示例11: _get_make_picks_page

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import click [as 别名]
    def _get_make_picks_page(self):
        """
        Logs in to mlb beat the streak site
        """
        ## Are we already on it?
        if self.pageTitles['picks'] in self.browser.title:
            return

        ## Else navigate to the login page
        if not self.pageTitles['login'] in self.browser.title:
            self._get_login_page()

        ## If we were already logged in, then now we are on the picks page
        if self.pageTitles['picks'] in self.browser.title:
            return
        
        # Otherwise, we need to login
        login = WebDriverWait(self.browser, 10).until(
            EC.presence_of_element_located((By.ID, 'login_email')))
        login.send_keys(self.username)
        pword = WebDriverWait(self.browser, 10).until(
            EC.presence_of_element_located((By.ID, 'login_password')))
        pword.send_keys(self.password)
        submit = WebDriverWait(self.browser, 10).until(
            EC.presence_of_element_located((By.NAME, 'submit')))
        submit.click()
        time.sleep(3)
        assert self.browser.title == self.pageTitles['picks']
开发者ID:frahman5,项目名称:beatthestreakBots,代码行数:30,代码来源:bot.py

示例12: __get_team_selection_dropdown

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import click [as 别名]
    def __get_team_selection_dropdown(self, **kwargs):
        """
        kwargs --> None
           team: str | team for which we are selecting the dropdown

        """
        ## Extract variables
        team = kwargs['team']

        ## Typecheck
        assert type(team) == str

        ## Necessary team conversions
        team = self.__convert_team(team)

        ## Make sure the player selection dropdown has been dropped
        self._get_player_selection_dropdown()
        selectTeam = WebDriverWait(self.browser, 10).until(
            EC.presence_of_element_located((By.ID, 'team-name')))
        selectTeam.click()
        time.sleep(3)

        # click on desired team
        team = WebDriverWait(self.browser, 10).until(
            EC.presence_of_element_located((By.CLASS_NAME, team)))
        team.click()
        time.sleep(3)
开发者ID:frahman5,项目名称:beatthestreakBots,代码行数:29,代码来源:bot.py

示例13: test_check_job_details_page

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import click [as 别名]
    def test_check_job_details_page(self):
        driver=self.driver
	self.mine_job()
        job_id=self.submit_job()
        self.assertTrue(self.wait_job_end(job_id))
        self.open_job_page(job_id)
        recipeset_id=self.get_recipe_set_id_from_openning_job_page()
        recipe_id=self.get_recipe_id_from_openning_job_page()
        driver.find_element_by_xpath("//a[@class='btn results-tab']").click()
        driver.find_element_by_xpath("//a[@class='btn hide-results-tab']").click()
        driver.find_element_by_xpath("//button[@class='btn']").click()
        driver.find_element_by_xpath("//button[@class='btn']").click()
        #update whiteboard
        driver.find_element_by_xpath("//a[@class='list']").click()
        driver.find_element_by_id("whiteboard").send_keys("Automation-test")
        driver.find_element_by_xpath("//button[@type='submit']").click()
        #update Rentention Tag
        driver.refresh()
        table=WebDriverSelect(driver.find_element_by_id("job_retentiontag"))
        table.select_by_index(7)
        element = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//div[@class='ui-dialog-buttonset']/button[1]")))
        element.click()
        driver.refresh()
        table=WebDriverSelect(driver.find_element_by_id("job_retentiontag"))
        table.select_by_index(2)
        element = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//div[@class='ui-dialog-buttonset']/button[1]")))
        element.click()
        #Check kickstart is avaiable
        driver.refresh()
        driver.find_element_by_xpath("//a[contains(@href,'kickstart')]").click()
        self.assertIn("%post",driver.page_source)
开发者ID:xuanjia,项目名称:beaker-webauto,代码行数:33,代码来源:job.py

示例14: test_edytujF

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import click [as 别名]
	def test_edytujF(self):
		driver = self.driver
		# filtruje po FV
		self.driver.get('http://printmanager.local/index.php/invoices/index/1/2')
		EditBtn = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(".//*[@id='search_by']/table/tbody/tr[1]/td[2]/a/span"))
		EditBtn.click()
		print "---kliknieto edytuj prace"
开发者ID:mindagony,项目名称:Printmanager,代码行数:9,代码来源:F6d.py

示例15: setHostname

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import click [as 别名]
    def setHostname(self, name, desc):
        driver = self.driver
        hostname=name
        
        #Change to the Settings tab in a Microhard
        settingButtonXpath = "//a[@href='/cgi-bin/webif/system-settings.sh']"
        settingButtonEle = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(settingButtonXpath))
        settingButtonEle.click()
        
        #Change Hostname Field
        hostnameFieldXpath = "//input[@name='hostname']"
        hostanmeFieldElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(hostnameFieldXpath))
        hostanmeFieldElement.clear()
        hostanmeFieldElement.send_keys(hostname)

        fieldXpath = "//input[@name='description']"
        fieldElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(fieldXpath))
        fieldElement.clear()
        fieldElement.send_keys(desc)
        
        
        #Submit the change, like a commit
        commitFieldXpath = "//a[@href='#'][@id='waitbox']"
        commitFieldElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(commitFieldXpath))
        commitFieldElement.click()
开发者ID:samulord,项目名称:microhard_provision,代码行数:27,代码来源:mhcpost.py


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