• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python expected_conditions.title_contains函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_login_and_post

 def test_login_and_post(self):
     # Go to the coop home page  
     self.driver.get("https://bc.libraries.coop/")
     # Log in
     self.driver.find_element_by_id("loginbtn").click()
     usernameField_present = EC.presence_of_element_located((By.ID, 'user_login'))
     WebDriverWait(self.driver, 10).until(usernameField_present)
     self.driver.find_element_by_id("user_login").send_keys(self.config['account']['username'])
     time.sleep(2)
     self.driver.find_element_by_id("user_pass").send_keys(self.config['account']['password'])
     time.sleep(2)
     self.driver.find_element_by_id("user-submit").click()
     time.sleep(2)
     # Navigate to My Dashboard
     self.driver.find_element_by_id("loginbtn").click()
     dashboardButton_present = EC.presence_of_element_located((By.LINK_TEXT, 'My Dashboard'))
     WebDriverWait(self.driver, 10).until(dashboardButton_present)
     self.driver.find_element_by_link_text("My Dashboard").click()
     WebDriverWait(self.driver, 10).until(EC.title_contains("Dashboard |"))
     # Navigate to test group, write and publish a post
     self.driver.find_element_by_xpath("//span[@class='group-title']").click()
     WebDriverWait(self.driver, 10).until(EC.title_contains("Home | Maple Public Library |"))
     self.driver.find_element_by_xpath("//textarea[@id='whats-new'][@name='whats-new']").send_keys(
         "This is a test post by Selenium Webdriver")
     self.driver.find_element_by_xpath(
         "//input[@id='aw-whats-new-submit']").send_keys("\n") # NOTE: Need to send "\n" instead of click for some weird wordpress buttons..
     # Check that the post is present, then delete it
     post_present = EC.presence_of_element_located((
         By.XPATH, "//div[@class='activity-inner']/p[text()='This is a test post by Selenium Webdriver']/../../div[@class='activity-meta']/a[text()='Delete']"))
     WebDriverWait(self.driver, 10).until(post_present)
     self.driver.find_element_by_xpath(
         "//div[@class='activity-inner']/p[text()='This is a test post by Selenium Webdriver']/../../div[@class='activity-meta']/a[text()='Delete']").send_keys("\n")
开发者ID:BCLibCoop,项目名称:selenium-testsuites,代码行数:32,代码来源:coopweb.py


示例2: listing_type

def listing_type(driver, params):
    print(('Listing types:'
           '\n\tAll Listings (1)'
           '\n\tAuction (2)'
           '\n\tBuy It Now (3)'))
    user_input = input('Choose 1-3: ')

    if user_input == '1':
        driver.set_window_size(1440, 900)
        button = driver.find_element_by_xpath(r'//*[@title="All Listings"]')
        button.click()
        WebDriverWait(driver, 10).until(ec.title_contains(params))
    elif user_input == '2':
        driver.set_window_size(1440, 900)
        button = driver.find_element_by_xpath(r'//*[@title="Auction"]')
        button.click()
        WebDriverWait(driver, 10).until(ec.title_contains(params))
    elif user_input == '3':
        driver.set_window_size(1440, 900)
        button = driver.find_element_by_xpath(r'//*[@title="Buy It Now"]')
        button.click()
        WebDriverWait(driver, 10).until(ec.title_contains(params))
    else:
        print('{} does not appear to be a correct choice, please try again'.format(user_input))
        listing_type(driver, params)
开发者ID:MidasBobidas,项目名称:eBayItemSearch,代码行数:25,代码来源:eBayItemSearch.py


示例3: testExpectedConditionTitleContains

 def testExpectedConditionTitleContains(self, driver, pages):
     pages.load("blank.html")
     driver.execute_script("setTimeout(function(){document.title='not blank'}, 200)")
     WebDriverWait(driver, 1).until(EC.title_contains("not"))
     assert driver.title == 'not blank'
     with pytest.raises(TimeoutException):
         WebDriverWait(driver, 0.7).until(EC.title_contains("blanket"))
开发者ID:zhjwpku,项目名称:selenium,代码行数:7,代码来源:webdriverwait_tests.py


示例4: _do_signup

    def _do_signup(self):
        # Go to the webpage
        self.browser.get(self.url)
        wait = ui.WebDriverWait(self.browser, self.timeout)
        wait.until(expected_conditions.visibility_of_element_located(["id", "logo"]))

        # Log out any existing user
        if self.browser.find_elements_by_id("nav_logout"):
            nav = self.browser.find_element_by_id("nav_logout")
            if nav.is_displayed():
                self.browser.find_element_by_id("nav_logout").click()
                wait = ui.WebDriverWait(self.browser, self.timeout)
                wait.until(expected_conditions.title_contains(("Home")))

        # Go to the sign-up page
        wait = ui.WebDriverWait(self.browser, self.timeout)
        wait.until(expected_conditions.visibility_of_element_located(["id", "nav_signup"]))
        self.browser.find_element_by_id("nav_signup").click()
        wait = ui.WebDriverWait(self.browser, self.timeout)
        wait.until(expected_conditions.title_contains(("Sign up")))

        # Sign up (don't choose facility or group)
        wait = ui.WebDriverWait(self.browser, self.timeout)
        wait.until(expected_conditions.visibility_of_element_located(["id", "id_username"]))
        self.browser.find_element_by_id("id_username").send_keys(self.username)
        wait = ui.WebDriverWait(self.browser, self.timeout)
        wait.until(expected_conditions.visibility_of_element_located(["id", "id_password_first"]))
        self.browser.find_element_by_id("id_password_first").send_keys(self.password)
        self.browser.find_element_by_id("id_password_recheck").send_keys(self.password)
        self.browser.find_element_by_id("id_password_recheck").send_keys(Keys.TAB + Keys.RETURN)
        wait = ui.WebDriverWait(self.browser, self.timeout)
        wait.until(expected_conditions.visibility_of_element_located(["id", "logo"]))
开发者ID:Aypak,项目名称:ka-lite,代码行数:32,代码来源:base.py


示例5: test_register_as_institution

 def test_register_as_institution(self):
     # Go to the bcla home page  
     self.driver.get("https://dev.bclaconnect.ca")
     WebDriverWait(self.driver, 10).until(EC.title_contains("BCLA Connect"))
     # Hover over myBCLA button, click join button
     mouse = webdriver.ActionChains(self.driver)
     myBCLA = self.driver.find_element_by_xpath("//a[@href='/mybcla']")
     mouse.move_to_element(myBCLA).perform()
     joinButton_present = EC.presence_of_element_located((By.XPATH, "//a[@href='/membership/join-bcla/'][@class='bcla-login-link']"))
     WebDriverWait(self.driver, 10).until(joinButton_present)
     self.driver.find_element_by_xpath("//a[@href='/membership/join-bcla/'][@class='bcla-login-link']").click()
     # Choose institutional membership
     WebDriverWait(self.driver, 10).until(EC.title_contains("Join BCLA |"))
     self.driver.find_element_by_link_text("Institutional Membership").click()
     WebDriverWait(self.driver, 10).until(EC.title_contains("Institutional Membership"))
     # Fill in form
     self.driver.find_element_by_id("CIVICRM_QFID_490_16").click()
     randomString = ''.join(random.SystemRandom().choice(string.ascii_lowercase + string.digits) for _ in range(5))
     mailAddress = randomString + '@mailinator.com'
     self.driver.find_element_by_id("email-5").send_keys(mailAddress)
     usrName = self.config['account']['username'] + randomString
     self.driver.find_element_by_id("onbehalf_organization_name").send_keys(usrName)
     self.driver.find_element_by_id("onbehalf_phone-3-1").send_keys(self.config['account']['phone'])
     self.driver.find_element_by_id("onbehalf_email-3").send_keys(mailAddress)
     self.driver.find_element_by_id("onbehalf_street_address-3").send_keys(self.config['account']['address'])
     self.driver.find_element_by_id("onbehalf_city-3").send_keys(self.config['account']['city'])
     self.driver.find_element_by_id("onbehalf_postal_code-3").send_keys(self.config['account']['postal'])
     self.driver.find_element_by_id("cms_name").send_keys(usrName)
     self.driver.find_element_by_id("cms_pass").send_keys(self.config['account']['password'])
     self.driver.find_element_by_id("cms_confirm_pass").send_keys(self.config['account']['password'])
     self.driver.find_element_by_id("first_name").send_keys(self.config['account']['firstname'])
     self.driver.find_element_by_id("last_name").send_keys(self.config['account']['lastname'])
     self.driver.find_element_by_xpath("//a[@class='crm-credit_card_type-icon-mastercard']").click()
     self.driver.find_element_by_id("credit_card_number").send_keys('5555555555554444')
     self.driver.find_element_by_id("cvv2").send_keys('066')
     self.driver.find_element_by_xpath("//select[@id='credit_card_exp_date_M']/option[text()='Jan']").click()
     self.driver.find_element_by_xpath("//select[@id='credit_card_exp_date_Y']/option[text()='2026']").click()
     self.driver.find_element_by_id("billing_first_name").send_keys(self.config['account']['firstname'])
     self.driver.find_element_by_id("billing_last_name").send_keys(self.config['account']['lastname'])
     self.driver.find_element_by_id("billing_street_address-5").send_keys(self.config['account']['address'])
     self.driver.find_element_by_id("billing_city-5").send_keys(self.config['account']['city'])
     self.driver.find_element_by_id("billing_postal_code-5").send_keys(self.config['account']['postal'])
     self.driver.find_element_by_id("CIVICRM_QFID_0_12").click()
     self.driver.find_element_by_id("_qf_Main_upload-bottom").click()
     #Click "make payment"
     paymentButton_present = EC.presence_of_element_located((By.ID, "_qf_Confirm_next-top"))
     WebDriverWait(self.driver, 10).until(paymentButton_present)
     self.driver.find_element_by_id("_qf_Confirm_next-top").click()
     # Check that payment went through
     WebDriverWait(self.driver, 60).until(EC.title_contains("Welcome to BCLA"))
     src = self.driver.page_source
     text_found = re.search(r'Your transaction has been processed successfully. Please print this page for your records.', src)
     self.assertNotEqual(text_found, None)
     # Check the email was sent and received
     self.driver.get("https://www.mailinator.com/inbox2.jsp?public_to=" + randomString + "#/#public_maildirdiv")
     WebDriverWait(self.driver, 30).until(EC.title_contains("Mailinator"))
     print("Mailbox at:")
     print("https://www.mailinator.com/inbox2.jsp?public_to=" + randomString + "#/#public_maildirdiv")
     print("Should contain a welcome message and receipt for an institutional membership.")
开发者ID:BCLibCoop,项目名称:selenium-testsuites,代码行数:59,代码来源:BCLA.py


示例6: testLogin

	def testLogin(self):
		driver = self.browser
		driver.get('https://localhost:8000/formular/')
		element = WebDriverWait(driver, 10).until(EC.title_contains('OpenID'))
		sub = driver.find_element_by_id('j_username').send_keys(id)
		driver.find_element_by_id('j_password').send_keys(password)
		driver.find_element_by_xpath("html/body/div/div/div/form/div/input").click()
		element = WebDriverWait(driver, 10).until(EC.title_contains('HPC'))
		self.assertIn('HPC', driver.title)
开发者ID:sv91,项目名称:projectproposal,代码行数:9,代码来源:tests.py


示例7: testExpectedConditionTitleContains

 def testExpectedConditionTitleContains(self, driver, pages):
     if driver.capabilities['browserName'] == 'firefox' and driver.w3c:
         pytest.xfail("Marionette issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1297551")
     pages.load("blank.html")
     driver.execute_script("setTimeout(function(){document.title='not blank'}, 200)")
     WebDriverWait(driver, 1).until(EC.title_contains("not"))
     assert driver.title == 'not blank'
     with pytest.raises(TimeoutException):
         WebDriverWait(driver, 0.7).until(EC.title_contains("blanket"))
开发者ID:glib-briia,项目名称:selenium,代码行数:9,代码来源:webdriverwait_tests.py


示例8: testExpectedConditionTitleContains

 def testExpectedConditionTitleContains(self):
     self._loadPage("blank")
     self.driver.execute_script("setTimeout(function(){document.title='not blank'}, 200)")
     WebDriverWait(self.driver, 1).until(EC.title_contains("not"))
     self.assertEqual(self.driver.title, 'not blank')
     try:
         WebDriverWait(self.driver, 0.7).until(EC.title_contains("blanket"))
         self.fail("Expected TimeoutException to have been thrown")
     except TimeoutException as e:
         pass
开发者ID:NextGenIntelligence,项目名称:selenium,代码行数:10,代码来源:webdriverwait_tests.py


示例9: log_user_in

 def log_user_in(self, username, password):
     self.browser.get(self.url)
     self.wait.until(EC.title_contains('Log in'))
     login_box = self.wait.until(
         EC.presence_of_element_located((By.ID, 'id_username')))
     login_box.send_keys(username)
     password_box = self.wait.until(
         EC.presence_of_element_located((By.ID, 'id_password')))
     password_box.send_keys(password)
     password_box.send_keys(Keys.ENTER)
     self.wait.until(EC.title_contains('Facility Management'))
     self.logged_in = True
开发者ID:triquetra011,项目名称:eha-facility-management,代码行数:12,代码来源:mdg_importer.py


示例10: _do_login_step_1

 def _do_login_step_1(self, args):
     wait = ui.WebDriverWait(self.browser, self.timeout)
     wait.until(expected_conditions.title_contains(("Log in")))
     wait = ui.WebDriverWait(self.browser, self.timeout)
     wait.until(expected_conditions.element_to_be_clickable((By.ID, "id_username")))         
     elem = self.browser.find_element_by_id("id_username")
     elem.send_keys(args["username"])
     elem = self.browser.find_element_by_id("id_password")
     elem.send_keys(args["password"])
     elem.send_keys(Keys.RETURN)
     wait = ui.WebDriverWait(self.browser, self.timeout)
     wait.until(expected_conditions.title_contains(("User report")))
开发者ID:mjptak,项目名称:ka-lite,代码行数:12,代码来源:benchmark_test_cases.py


示例11: test_aregister_as_individual

 def test_aregister_as_individual(self):
     # This test creates the account that "test_donate_as_individual" uses, hence the "a" in the name, so Selenium runs it first
     # Go to the bcla home page  
     self.driver.get("https://dev.bclaconnect.ca")
     WebDriverWait(self.driver, 10).until(EC.title_contains("BCLA Connect"))
     # Hover over myBCLA button, click join button
     mouse = webdriver.ActionChains(self.driver)
     myBCLA = self.driver.find_element_by_xpath("//a[@href='/mybcla']")
     mouse.move_to_element(myBCLA).perform()
     joinButton_present = EC.presence_of_element_located((By.XPATH, "//a[@href='/membership/join-bcla/'][@class='bcla-login-link']"))
     WebDriverWait(self.driver, 10).until(joinButton_present)
     self.driver.find_element_by_xpath("//a[@href='/membership/join-bcla/'][@class='bcla-login-link']").click()
     # Choose individual membership
     WebDriverWait(self.driver, 10).until(EC.title_contains("Join BCLA |"))
     self.driver.find_element_by_link_text("Individual Membership").click()
     WebDriverWait(self.driver, 10).until(EC.title_contains("Individual Membership |"))
     # Fill in form
     mailAddress = BCLATests.individualRandomString + '@mailinator.com'
     self.driver.find_element_by_id("email-5").send_keys(mailAddress)
     self.driver.find_element_by_id("cms_name").send_keys(self.config['account']['username'] + BCLATests.individualRandomString)
     self.driver.find_element_by_id("cms_pass").send_keys(self.config['account']['password'])
     self.driver.find_element_by_id("cms_confirm_pass").send_keys(self.config['account']['password'])
     self.driver.find_element_by_id("first_name").send_keys(self.config['account']['firstname'])
     self.driver.find_element_by_id("last_name").send_keys(self.config['account']['lastname'])
     self.driver.find_element_by_id("street_address-Primary").send_keys(self.config['account']['address'])
     self.driver.find_element_by_id("city-Primary").send_keys(self.config['account']['city'])
     #self.driver.find_element_by_xpath("//div[@id='s2id_state_province-Primary']").click()
     self.driver.find_element_by_id("postal_code-Primary").send_keys(self.config['account']['postal'])
     self.driver.find_element_by_xpath("//a[@class='crm-credit_card_type-icon-mastercard']").click()
     self.driver.find_element_by_id("credit_card_number").send_keys('5555555555554444')
     self.driver.find_element_by_id("cvv2").send_keys('066')
     self.driver.find_element_by_xpath("//select[@id='credit_card_exp_date_M']/option[text()='Jan']").click()
     self.driver.find_element_by_xpath("//select[@id='credit_card_exp_date_Y']/option[text()='2026']").click()
     self.driver.find_element_by_id("CIVICRM_QFID_0_12").click()
     self.driver.find_element_by_id("_qf_Main_upload-bottom").click()
     #Click "make payment"
     paymentButton_present = EC.presence_of_element_located((By.ID, "_qf_Confirm_next-top"))
     WebDriverWait(self.driver, 10).until(paymentButton_present)
     self.driver.find_element_by_id("_qf_Confirm_next-top").click()
     # Check that payment went through
     WebDriverWait(self.driver, 60).until(EC.title_contains("Welcome to BCLA"))
     src = self.driver.page_source
     text_found = re.search(r'Your transaction has been processed successfully. Please print this page for your records.', src)
     self.assertNotEqual(text_found, None)
     # Check the email was sent and received
     self.driver.get("https://www.mailinator.com/inbox2.jsp?public_to=" + BCLATests.individualRandomString + "#/#public_maildirdiv")
     WebDriverWait(self.driver, 30).until(EC.title_contains("Mailinator"))
     print("Mailbox at:")
     print("https://www.mailinator.com/inbox2.jsp?public_to=" + BCLATests.individualRandomString + "#/#public_maildirdiv")
     print("Should contain a welcome message and receipt for an individual membership.")
     self.driver.quit()
开发者ID:BCLibCoop,项目名称:selenium-testsuites,代码行数:51,代码来源:BCLA.py


示例12: get_auth_cookie

def get_auth_cookie(domain, login, password):

    # configure chrome
    options = Options()
    #options.add_argument('--headless')
    #options.add_argument('--disable-gpu')
    options.add_argument('--window-size=700,600')

    driver = webdriver.Chrome(chrome_options=options)

    # load the login page and wait until the title contains GitLab
    driver.get("https://{}/login".format(domain))
    WebDriverWait(driver, 10).until(EC.title_contains("GitLab"))

    # click on the gitlab button to continue
    gitlabElement = driver.find_element_by_partial_link_text("GitLab")
    gitlabElement.click()

    # wait for the sign in page to load
    WebDriverWait(driver, 10).until(EC.title_contains("Sign in"))

    # fill out the username
    emailElement = driver.find_element_by_id('username')
    emailElement.send_keys(login)

    # fill out the password
    passwordElement = driver.find_element_by_id('password')
    passwordElement.send_keys(password)

    # submit the form
    passwordElement.submit()

    # wait until the page loads
    WebDriverWait(driver, 600).until(EC.title_contains("User Settings"))

    # authorize mattermost to use your account
    #elementAuthorize = driver.find_element_by_name('commit')
    elementAuthorize = driver.find_element_by_css_selector('input.btn-success')
    elementAuthorize.click()

    WebDriverWait(driver, 600).until(EC.title_contains("Mattermost"))

    auth_cookie = None
    for cookie in driver.get_cookies():
        if cookie['name'] == 'MMAUTHTOKEN':
            auth_cookie = cookie

    driver.quit()

    return auth_cookie
开发者ID:codybuell,项目名称:dotfiles,代码行数:50,代码来源:mattermost-auth.py


示例13: test_login_and_create_doc

 def test_login_and_create_doc(self):
     # Go to the coop home page  
     self.driver.get("https://bc.libraries.coop/")
     # Log in
     self.driver.find_element_by_id("loginbtn").click()
     usernameField_present = EC.presence_of_element_located((By.ID, 'user_login'))
     WebDriverWait(self.driver, 10).until(usernameField_present)
     self.driver.find_element_by_id("user_login").send_keys(self.config['account']['username'])
     time.sleep(2)
     self.driver.find_element_by_id("user_pass").send_keys(self.config['account']['password'])
     time.sleep(2)
     self.driver.find_element_by_id("user-submit").click()
     time.sleep(2)
     # Go to Profile, Docs tab, click Create New Doc
     self.driver.find_element_by_id("loginbtn").click()
     profileButton_present = EC.presence_of_element_located((By.LINK_TEXT, 'My Profile'))
     WebDriverWait(self.driver, 10).until(profileButton_present)
     self.driver.find_element_by_link_text("My Profile").click()
     WebDriverWait(self.driver, 10).until(EC.title_contains("Profile |"))
     self.driver.find_element_by_id("user-docs").click()
     WebDriverWait(self.driver, 10).until(EC.title_contains("Docs |"))
     self.driver.find_element_by_id("bp-create-doc-button").click()
     # Fill in Doc creation form
     titleField_present = EC.presence_of_element_located((By.ID, 'doc-title'))
     WebDriverWait(self.driver, 10).until(titleField_present)
     self.driver.find_element_by_id("doc-title").send_keys("Selenium Test Document")
     self.driver.find_element_by_id("doc_content-html").click()
     contentField_present = EC.presence_of_element_located((By.XPATH, "//textarea[@id='doc_content'][@name='doc_content']"))
     WebDriverWait(self.driver, 10).until(contentField_present)
     self.driver.find_element_by_xpath("//textarea[@id='doc_content'][@name='doc_content']").send_keys(
         "This is a test document created to test site functionality with Selenium Webdriver.")
     self.driver.find_element_by_xpath("//select[@id='settings-read']/option[text()='The Doc author only']").click()
     # Save doc and check it was succesfully created
     self.driver.find_element_by_id("doc-edit-submit").click()
     src = self.driver.page_source
     text_found = re.search(r'Doc successfully created', src)
     self.assertNotEqual(text_found, None)
     # Delete the doc and check it was succesfully deleted
     self.driver.find_element_by_link_text("Edit").click()
     deleteButton_present = EC.presence_of_element_located((By.LINK_TEXT, 'Permanently Delete'))
     WebDriverWait(self.driver, 10).until(deleteButton_present)
     self.driver.find_element_by_link_text("Permanently Delete").click()
     alert = self.driver.switch_to_alert() # This will cause a warning, but the "newer" method of this does not work.
     alert.accept()
     time.sleep(2)
     src = self.driver.page_source
     text_found = re.search(r'Doc successfully deleted', src)
     self.assertNotEqual(text_found, None)
开发者ID:BCLibCoop,项目名称:selenium-testsuites,代码行数:48,代码来源:coopweb.py


示例14: _click_sign_in_button

 def _click_sign_in_button(self):
     """
     Clicks the Sign In button.
     """
     self._driver.find_element(*self._sign_in_button).click()
     self._wait.until(ec.title_contains(self.page_title), "The page does not contain the " + self.page_title + " title.")
     return self
开发者ID:mmguzman,项目名称:Xinet,代码行数:7,代码来源:LoginPageBase.py


示例15: test_google_search

	def test_google_search(self):
		# Create a new instance of the Firefox self.driver
		#self.driver = webself.driver.Firefox()

		# go to the google home page
		self.driver.get("http://www.google.com")

		# find the element that's name attribute is q (the google search box)
		inputElement = self.driver.find_element_by_name("q")

		# type in the search
		inputElement.send_keys("cheese!")

		# submit the form (although google automatically searches now without submitting)
		inputElement.submit()

		# the page is ajaxy so the title is originally this:
		print( self.driver.title )

		try:
		    # we have to wait for the page to refresh, the last thing that seems to be updated is the title
		    WebDriverWait(self.driver, 10).until(EC.title_contains("cheese!"))

		    # You should see "cheese! - Google Search"
		    print( self.driver.title )
		    self.assertTrue(  self.driver.title.find(  "cheese!" ) != -1 )

		finally:
		    self.driver.quit()
开发者ID:franleplant,项目名称:selenium-nator,代码行数:29,代码来源:test1.py


示例16: wait_until_title_contains

    def wait_until_title_contains(self, phrase):
        """ Wait for title to contain supplied phrase

            :param phrase: phrase contained in title
            :type phrase: str
        """
        self.wait.until(EC.title_contains(phrase))
开发者ID:duepayer,项目名称:fender,代码行数:7,代码来源:__init__.py


示例17: bind

  def bind(self):
    ''' Class [ GoogleSeleniumKlass ] - bind(none) => Access '''
    driver = self.getDriver();
    try:
      driver.get(self.url);
      elem = driver.find_element(
        By.XPATH,
        '//*[@id="lst-ib"]'
      );
      elem.send_keys('python');
      elem.send_keys(self.keys.RETURN);
      self.getWaiting().until(EC.title_contains('- Google'));
    except NoSuchElementException:
      print '\n-+-+-+- NoSuchElementException -+-+-+-\n';
    except TimeoutException:
      print '\n-+-+-+- TimeoutException -+-+-+-\n';
    finally:
      print '\nFin.\n'
      driver.close();

# Sub Import
# from GoogleSelenium import GoogleSeleniumKlass;
## [Test] - GoogleSelenium Klass
# test = GoogleSeleniumKlass(
#   'Google',
#   'https://www.google.co.jp/'
# );
# test.bind();
开发者ID:iiiiiwan,项目名称:python,代码行数:28,代码来源:GoogleSelenium.py


示例18: test_chrome

    def test_chrome(self):
        """Can I get chrome to work via WebDriver?"""

        # Create a new instance of the Chrome driver
        driver = webdriver.Chrome()

        # go to the google home page
        driver.get("http://www.google.com")

        # the page is ajaxy so the title is originally this:
        print driver.title

        # find the element that's name attribute is q (the google search box)
        input_element = driver.find_element_by_name("q")

        # type in the search
        input_element.send_keys("cheese!")

        # submit the form (although google automatically searches now without submitting)
        input_element.submit()

        try:
            # we have to wait for the page to refresh, the last thing that seems
            # to be updated is the title
            WebDriverWait(driver, 10).until(EC.title_contains("cheese!"))

            # You should see "cheese! - Google Search"
            print driver.title

            if driver.title != "cheese! - Google Search":
                self.fail()

        finally:
            driver.quit()
开发者ID:MikeTheGreat,项目名称:GLT,代码行数:34,代码来源:SeleniumTest.py


示例19: test_github_project

def test_github_project(driver):
    driver.get('https://github.com/meejah/txtorcon')

    body = driver.find_element_by_tag_name('body')

    # activate the "file finder"
    ActionChains(driver) \
        .move_to_element(body) \
        .click(on_element=body) \
        .send_keys_to_element(body, 't') \
        .perform()

    # wait up to 5 seconds until it's "actually" activated (which we
    # know because an element with a particular ID will be visible)
    finder = WebDriverWait(driver, timeout=5.0).until(
        EC.presence_of_element_located(
            (By.ID, "tree-finder-field")
        )
    )

    # now we press "down" three times, and return...
    ActionChains(driver) \
        .send_keys_to_element(finder, Keys.ARROW_DOWN) \
        .send_keys_to_element(finder, Keys.ARROW_DOWN) \
        .send_keys_to_element(finder, Keys.ARROW_DOWN) \
        .send_keys_to_element(finder, Keys.ENTER) \
        .perform()

    # ...which we confirm because this "should" have loaded the Dockerfile
    WebDriverWait(driver, 5.0).until(EC.title_contains('Dockerfile'))
开发者ID:ivan-krukov,项目名称:pytest-selenium,代码行数:30,代码来源:test_github.py


示例20: getBofa

def getBofa(*args):
	username = args[0][2]
	password = args[0][3]

	driver = webdriver.Firefox()
	
	driver.get(url)
	wait = lambda msg: WebDriverWait(driver, 10).until(EC.title_contains(msg))

	driver.find_element_by_id("onlineId1").send_keys(username)
	driver.find_element_by_id("passcode1").send_keys(password)
	driver.find_element_by_id("hp-sign-in-btn").click()
	wait("Bank of America")

	if (driver.current_url.find(failedUrl) == -1 and driver.current_url.find(successUrl) != -1):
		driver.quit()
		raise Exception("Your Password or Username were incorrect!")
	wait("Bank of America")

	if (driver.current_url == secureURl):
		raise Exception("Your identity needs to be verified. Please enter your information and try again")

	wait("Accounts Overview")

	balance = driver.find_element_by_xpath("//*[@id=\"Traditional\"]/li[1]/div[1]/div[1]")
	print "Your Checkings Balance is " + balance.text + "."

	driver.find_element_by_name("onh_sign_off").click()
	driver.quit()
开发者ID:cesarvh,项目名称:automateMe,代码行数:29,代码来源:automateMe.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap