本文整理汇总了Python中selenium.webdriver.support.expected_conditions.title_is函数的典型用法代码示例。如果您正苦于以下问题:Python title_is函数的具体用法?Python title_is怎么用?Python title_is使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了title_is函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_login_success
def test_login_success(self):
self.browser1 = webdriver.Firefox()
self.browser2 = webdriver.Firefox()
for i in range(100):
# Step 1: Open the homepage of the installation
self.browser1.get(url)
self.browser2.get(url)
# Step 2: Enter the username and the password in the login box
loginpage1 = LoginPage(self.browser1)
loginpage2 = LoginPage(self.browser2)
loginpage1.login(user, password)
loginpage2.login(user, password)
# Step 3: Assert that the login is sucessful
h1_1 = self.browser1.find_element_by_tag_name('h1')
self.assertIn('Welcome', h1_1.text)
h1_2 = self.browser2.find_element_by_tag_name('h1')
self.assertIn('Welcome', h1_2.text)
# Step 4: Logout
self.browser1.get(url+"/identity/logout")
self.browser2.get(url+"/identity/logout")
wait = WebDriverWait(self.browser1, 10)
wait.until(EC.title_is('Gluu'))
wait = WebDriverWait(self.browser2, 10)
wait.until(EC.title_is('Gluu'))
self.browser1.quit()
self.browser2.quit()
示例2: test_browser_navigation
def test_browser_navigation(self):
#driver = self.driver
# get the search textbox
search_field = self.driver.find_element_by_name('q')
search_field.clear()
# enter search keyword and submit
search_field.send_keys('selenium webdriver')
search_field.submit()
se_wd_link = self.driver.find_element_by_link_text('Selenium WebDriver')
se_wd_link.click()
self.assertTrue(WebDriverWait(self.driver, 10)
.until(EC.title_is('Selenium WebDriver')))
self.driver.back()
self.assertTrue(WebDriverWait(self.driver, 10)
.until(EC.title_contains('selenium webdriver - ')))
self.driver.forward()
self.assertTrue(WebDriverWait(self.driver, 10)
.until(EC.title_is('Selenium WebDriver')))
self.driver.refresh()
self.assertTrue(WebDriverWait(self.driver, 10)
.until(EC.title_is('Selenium WebDriver')))
示例3: testBrowserNavigation
def testBrowserNavigation(self):
driver = self.driver
# get the search textbox
search_field = driver.find_element_by_name("q")
search_field.clear()
# enter search keyword and submit
search_field.send_keys("selenium webdriver")
search_field.submit();
print("submittt...")
se_wd_link = driver.find_element_by_link_text("Selenium WebDriver")
se_wd_link.click()
#self.assertEqual("selenium webdriver - Szukaj w Google", driver.title)
print("do tyluu...")
driver.back()
self.assertTrue(WebDriverWait(self.driver, 10).until(expected_conditions.title_is("selenium webdriver - Szukaj w Google")))
print("teraz do przodu")
driver.forward()
self.assertTrue(WebDriverWait(self.driver, 10).until(expected_conditions.title_is("Selenium WebDriver")))
print("bedzie refresh")
driver.refresh()
self.assertTrue(WebDriverWait(self.driver, 10).until(expected_conditions.title_is("Selenium WebDriver")))
示例4: test_login_and_edit
def test_login_and_edit(self):
self.driver.get(self.base + "/Fedora_Project_Wiki")
assert title_is(self.title), self.driver.title
elem = self.driver.find_element_by_id("pt-login")
elem.click()
assert title_is("Log in - " + self.title), self.driver.title
elem = self.driver.find_element_by_id("wpName1")
elem.send_keys(self.auth[0])
elem = self.driver.find_element_by_id("wpPassword1")
elem.send_keys(self.auth[1])
elem = self.driver.find_element_by_id("wpLoginAttempt")
elem.submit()
assert title_is(self.title), self.driver.title
self.driver.get(
"https://stg.fedoraproject.org/wiki/Rube_Test_Page")
elem = self.driver.find_element_by_id("ca-edit")
elem.click()
elem = self.driver.find_element_by_id("wpTextbox1")
elem.send_keys(Keys.PAGE_DOWN)
tag = str(uuid.uuid4())
s = "Test comment from Rube\n%s" % tag
elem.send_keys(s)
elem = self.driver.find_element_by_id("wpSave")
elem.submit()
self.wait_for(tag)
示例5: add_a_new_facility
def add_a_new_facility(self, facility):
self.go_to_facilities()
self.wait.until(EC.title_is('Facilities'))
link = self.wait.until(EC.presence_of_element_located(
(By.ID, 'id_add_new_facility_link')))
link.click()
self.wait.until(EC.title_is('Add New Facility'))
inputbox = self.wait.until(
EC.presence_of_element_located((By.ID, 'id_facility_name')))
inputbox.send_keys(facility.name)
self.browser.find_element_by_xpath(
'//select[@id="id_facility_type"]/option[text()="%s"]' %
facility.type).click()
inputbox = self.wait.until(
EC.presence_of_element_located((By.ID, 'id_facility_status')))
inputbox.send_keys(facility.status)
if facility.area:
select = Select(self.browser.find_element_by_id('id_facility_area'))
select.select_by_visible_text(unicode(facility.area))
if facility.json:
inputbox = self.wait.until(
EC.presence_of_element_located((By.ID, 'id_json')))
inputbox.send_keys(facility.json)
submit = self.browser.find_element_by_id('id_submit_button')
submit.click()
self.wait.until(EC.title_is('Facilities'))
示例6: test_login_and_edit_account
def test_login_and_edit_account(self):
self.driver.get(self.base)
assert title_is(self.title), self.driver.title
elem = self.driver.find_element_by_link_text("Log In")
elem.click()
title = "Login to the Fedora Accounts System"
assert title_is(title), self.driver.title
elem = self.driver.find_element_by_name("user_name")
elem.send_keys(self.auth[0])
elem = self.driver.find_element_by_name("password")
elem.send_keys(self.auth[1])
elem = self.driver.find_element_by_name("login")
elem.send_keys(Keys.ENTER)
title = "Fedora Accounts System"
assert title_is(title), self.driver.title
elem = self.driver.find_element_by_link_text("My Account")
elem.click()
elem = self.driver.find_element_by_link_text("(edit)")
elem.click()
elem = self.driver.find_element_by_name("comments")
elem.send_keys(Keys.PAGE_DOWN)
tag = str(uuid.uuid4())
s = "Test comment from Rube\n%s" % tag
elem.send_keys(s)
elem = self.driver.find_element_by_xpath(
"/html/body/div/div[4]/div[2]/form/div[15]/input")
elem.submit()
self.wait_for(tag)
示例7: test_9dReport
def test_9dReport(self):
report = driver.find_element_by_link_text("Отчёты")
report.click()
time.sleep(1)
# Отчёт по контрольным точкам
report1 = driver.find_element_by_link_text("Отчёт по контрольным точкам")
report1.click()
title = wait.until(EC.title_is('ЭОР - Report'))
assert "500" not in driver.title # проверка на 500/404 ошибку
assert "404" not in driver.title
_ = wait.until(EC.element_to_be_clickable((By.ID, 'load_table')))
assert "500" not in driver.title # проверка на 500/404 ошибку
assert "404" not in driver.title
# Отчёт Проект Расписания
schedule = driver.find_element_by_link_text('Отчёт Проект Расписания')
schedule.click()
_ = wait.until(EC.element_to_be_clickable((By.CLASS_NAME, 'title_gears')))
title = wait.until(EC.title_is('ЭОР - Schedule'))
assert "500" not in driver.title # проверка на 500/404 ошибку
assert "404" not in driver.title
assert "ЭОР - Schedule" in driver.title
# Отчёт Рейтинги
rating = driver.find_element_by_link_text('Отчёт Рейтинги')
rating.click()
_ = wait.until(EC.element_to_be_clickable((By.CLASS_NAME, 'title_gears')))
title = wait.until(EC.title_is('ЭОР - Rating'))
assert "500" not in driver.title # проверка на 500/404 ошибку
assert "404" not in driver.title
assert "ЭОР - Rating" in driver.title
示例8: test_browser_navigation
def test_browser_navigation(self):
driver = self.driver
# get the search textbox
search_field = driver.find_element_by_name("q")
search_field.clear()
# enter search keyword and submit
search_field.send_keys("selenium webdriver")
search_field.submit()
se_wd_link = driver. \
find_element_by_link_text("Selenium WebDriver")
se_wd_link.click()
self.assertEqual("Selenium WebDriver", driver.title)
driver.back()
self.assertTrue(WebDriverWait(self.driver, 10)
.until(expected_conditions.title_is("selenium webdriver - Google Search")))
driver.forward()
self.assertTrue(WebDriverWait(self.driver, 10)
.until(expected_conditions.title_is("Selenium WebDriver")))
driver.refresh()
self.assertTrue(WebDriverWait(self.driver, 10)
.until(expected_conditions.title_is("Selenium WebDriver")))
示例9: testExpectedConditionTitleIs
def testExpectedConditionTitleIs(self, driver, pages):
pages.load("blank.html")
WebDriverWait(driver, 1).until(EC.title_is("blank"))
driver.execute_script("setTimeout(function(){document.title='not blank'}, 200)")
WebDriverWait(driver, 1).until(EC.title_is("not blank"))
assert driver.title == 'not blank'
with pytest.raises(TimeoutException):
WebDriverWait(driver, 0.7).until(EC.title_is("blank"))
示例10: test_task_D5
def test_task_D5(self):
# I want to display a view of my claim when I click on it in the list
self._login_user()
WebDriverWait(self.browser, 10).until(ec.presence_of_element_located((By.ID, 'view_claims_button')))
self.browser.find_element_by_id('view_claims_button').click()
WebDriverWait(self.browser, 10).until(ec.title_is('Claims View'))
WebDriverWait(self.browser, 10).until(ec.presence_of_element_located((By.CLASS_NAME, 'clickable-row')))
self.browser.find_element_by_class_name('clickable-row').click()
WebDriverWait(self.browser, 10).until(ec.title_is('View Claim'))
示例11: testExpectedConditionTitleIs
def testExpectedConditionTitleIs(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")
WebDriverWait(driver, 1).until(EC.title_is("blank"))
driver.execute_script("setTimeout(function(){document.title='not blank'}, 200)")
WebDriverWait(driver, 1).until(EC.title_is("not blank"))
assert driver.title == 'not blank'
with pytest.raises(TimeoutException):
WebDriverWait(driver, 0.7).until(EC.title_is("blank"))
示例12: test_login
def test_login(self):
from selenium.common.exceptions import TimeoutException
dbHelp.create_test_user_using_default_values()
self.loginEmail.send_keys("[email protected]")
self.loginPw.send_keys("123456")
self.loginButton.click()
WebDriverWait(self.driver,10).until(EC.title_is("Space Habit Frontier!"))
self.assertEqual(self.driver.title,"Space Habit Frontier!")
self.driver.get("http://127.0.0.1:8080/login")
self.assertRaises(TimeoutException,lambda :WebDriverWait(self.driver,5).until(EC.title_is("Login to Space Habit Frontier")))
示例13: test_task_D8
def test_task_D8(self):
# I want to be able to delete a claim
self._login_user()
WebDriverWait(self.browser, 10).until(ec.presence_of_element_located((By.ID, 'view_claims_button')))
self.browser.find_element_by_id('view_claims_button').click()
WebDriverWait(self.browser, 10).until(ec.title_is('Claims View'))
self.browser.find_element_by_class_name('clickable-row').click()
WebDriverWait(self.browser, 10).until(ec.title_is('View Claim'))
self.browser.find_element_by_id('id_delete_claim_button').click()
WebDriverWait(self.browser, 10).until(ec.title_is('Home'))
示例14: testExpectedConditionTitleIs
def testExpectedConditionTitleIs(self):
self._loadPage("blank")
WebDriverWait(self.driver, 1).until(EC.title_is("blank"))
self.driver.execute_script("setTimeout(function(){document.title='not blank'}, 200)")
WebDriverWait(self.driver, 1).until(EC.title_is("not blank"))
self.assertEqual(self.driver.title, 'not blank')
try:
WebDriverWait(self.driver, 0.7).until(EC.title_is("blank"))
self.fail("Expected TimeoutException to have been thrown")
except TimeoutException as e:
pass
示例15: testTitleEn
def testTitleEn(self):
driver = self.driver
driver.get(self.address)
elementTitle = WebDriverWait(driver, 10).until(
EC.title_is(u'Денисенко Денис')
)
eButtonEn = driver.find_element(By.XPATH, '//div[@class="block border indent header"]/div/a[@href="#en"]')
eButtonEn.send_keys(Keys.ENTER)
elementTitle = WebDriverWait(driver, 10).until(
EC.title_is(u'Denisenko Denis')
)
driver.close()