本文整理汇总了Python中selenium.webdriver.common.by.By.LINK_TEXT属性的典型用法代码示例。如果您正苦于以下问题:Python By.LINK_TEXT属性的具体用法?Python By.LINK_TEXT怎么用?Python By.LINK_TEXT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类selenium.webdriver.common.by.By
的用法示例。
在下文中一共展示了By.LINK_TEXT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test05CreateNewProjectWithAllFiles
# 需要导入模块: from selenium.webdriver.common.by import By [as 别名]
# 或者: from selenium.webdriver.common.by.By import LINK_TEXT [as 别名]
def test05CreateNewProjectWithAllFiles(self):
self.login()
WebDriverWait(self.browser, 5).until(EC.visibility_of_element_located((By.XPATH, '//button[@title="upload data files"]')))
self.browser.find_element_by_xpath('//button[@title="upload data files"]').click()
WebDriverWait(self.browser, 5).until(EC.visibility_of_element_located((By.ID, 'uploadTitle')))
self.browser.find_element_by_id('uploadTitle').send_keys('test_project_with_all_files')
self.browser.find_element_by_id('uploadDescription').send_keys('description of test project')
self.browser.find_element_by_id('treeFileSelect').send_keys(self.BASEPATH+'tree.txt')
self.browser.find_element_by_id('fastaFileSelect').send_keys(self.BASEPATH+'fasta.fa')
self.browser.find_element_by_id('dataFileSelect').send_keys(self.BASEPATH+'view_data.txt')
self.browser.find_element_by_id('samplesOrderFileSelect').send_keys(self.BASEPATH+'samples-order.txt')
self.browser.find_element_by_id('samplesInformationFileSelect').send_keys(self.BASEPATH+'samples-information.txt')
self.browser.find_element_by_id('uploadFiles').click()
WebDriverWait(self.browser, 5).until(EC.presence_of_element_located((By.LINK_TEXT, 'test_project_with_all_files')))
self.assertTrue(self.browser.find_element_by_link_text('test_project_with_all_files'))
示例2: go_to_table
# 需要导入模块: from selenium.webdriver.common.by import By [as 别名]
# 或者: from selenium.webdriver.common.by.By import LINK_TEXT [as 别名]
def go_to_table(self):
# Click in the top menu
self.selenium.find_element_by_id('ontask-base-table').click()
# Wait for the Full View to be clickable
WebDriverWait(self.selenium, 10).until(
EC.element_to_be_clickable(
(By.LINK_TEXT, 'Full view')
)
)
# Click on the full view element
self.selenium.find_element_by_link_text('Full view').click()
# Wait for page to refresh
WebDriverWait(self.selenium, 10).until(
EC.presence_of_element_located((By.ID, 'table-content'))
)
WebDriverWait(self.selenium, 10).until_not(
EC.visibility_of_element_located((By.ID, 'div-spinner'))
)
element = self.selenium.find_element_by_id('table-data')
if element:
# The table is present!
self.wait_for_datatable('table-data_previous')
self.assertIn('CSV Download', self.selenium.page_source)
示例3: go_to_upload_merge
# 需要导入模块: from selenium.webdriver.common.by import By [as 别名]
# 或者: from selenium.webdriver.common.by.By import LINK_TEXT [as 别名]
def go_to_upload_merge(self):
# Click in the top menu
self.selenium.find_element_by_id('ontask-base-table').click()
# Wait for the Full View to be clickable
WebDriverWait(self.selenium, 10).until(
EC.element_to_be_clickable(
(By.LINK_TEXT, 'Upload or merge data')
)
)
# Click on the upload and wait...
self.selenium.find_element_by_link_text('Upload or merge data').click()
WebDriverWait(self.selenium, 10).until(
EC.visibility_of_element_located(
(By.XPATH, '//table[@id="dataops-table"]')
)
)
示例4: check_datarequest
# 需要导入模块: from selenium.webdriver.common.by import By [as 别名]
# 或者: from selenium.webdriver.common.by.By import LINK_TEXT [as 别名]
def check_datarequest(self, datarequest_id, title, description, open, owner,
organization='None', accepted_dataset='None'):
driver = self.driver
driver.get(self.base_url + 'datarequest/' + datarequest_id)
self.assertEqual(title, driver.find_element_by_css_selector('h1.page-heading').text)
self.assertEqual(description, driver.find_element_by_css_selector('p').text)
self.assertEqual('OPEN' if open else 'CLOSED',
driver.find_element_by_xpath('//div[@id=\'content\']/div[3]/div/article/div/span').text)
if open:
self.assertEqual(owner, self.is_element_present(By.LINK_TEXT, 'Close'))
self.assertEqual(organization, driver.find_element_by_xpath(
'//div[@id=\'content\']/div[3]/div/article/div/section/table/tbody/tr[2]/td').text)
if not open:
self.assertEqual(accepted_dataset, driver.find_element_by_xpath(
'//div[@id=\'content\']/div[3]/div/article/div/section/table/tbody/tr[5]/td').text)
self.assertEqual(owner, self.is_element_present(By.LINK_TEXT, 'Manage'))
示例5: create_organization
# 需要导入模块: from selenium.webdriver.common.by import By [as 别名]
# 或者: from selenium.webdriver.common.by.By import LINK_TEXT [as 别名]
def create_organization(self, name, description, users):
driver = self.driver
driver.get(self.base_url)
WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.LINK_TEXT, 'Organizations'))).click()
WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.LINK_TEXT, 'Add Organization'))).click()
WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.ID, 'field-name')))
# Wait a bit to let ckan add javascript hooks
time.sleep(0.2)
driver.find_element_by_id('field-name').clear()
driver.find_element_by_id('field-name').send_keys(name)
driver.find_element_by_id('field-description').clear()
driver.find_element_by_id('field-description').send_keys(description)
driver.find_element_by_name('save').click()
# Add users
WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.LINK_TEXT, 'Manage'))).click()
WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.LINK_TEXT, 'Members'))).click()
for user in users:
WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.LINK_TEXT, 'Add Member'))).click()
WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.ID, "s2id_autogen1"))).send_keys(user + Keys.RETURN)
driver.find_element_by_name('submit').click()
示例6: check_acquired
# 需要导入模块: from selenium.webdriver.common.by import By [as 别名]
# 或者: from selenium.webdriver.common.by.By import LINK_TEXT [as 别名]
def check_acquired(self, dataset, dataset_url, acquired, private):
driver = self.driver
driver.get(self.base_url + 'dashboard')
WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.LINK_TEXT, 'Acquired Datasets'))).click()
if acquired and private:
# This message could not be shown when the user has acquired at least one dataset
self.assertEqual(None, re.search('You haven\'t acquired any datasets.', driver.page_source))
# Access the dataset
driver.find_element_by_link_text(dataset).click()
self.assertEqual(self.base_url + 'dataset/%s' % dataset_url, driver.current_url)
else:
# If the user has not acquired the dataset, a link to this dataset could not be in the acquired dataset list
self.assertEqual(None, re.search(dataset_url, driver.page_source))
# When a user has not acquired any dataset, a message will be shown to inform the user
self.assertNotEquals(None, re.search('You haven\'t acquired any datasets.', driver.page_source))
示例7: test_invalid_fields
# 需要导入模块: from selenium.webdriver.common.by import By [as 别名]
# 或者: from selenium.webdriver.common.by.By import LINK_TEXT [as 别名]
def test_invalid_fields(self, allowed_users, acquire_url, expected_msg):
# Create a default user
user = 'user1'
self.default_register(user)
# Create the dataset
self.login(user)
pkg_name = 'Dataset 2'
# Go the page to create the dataset
driver = self.driver
driver.get(self.base_url)
WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.LINK_TEXT, 'Datasets'))).click()
WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.LINK_TEXT, 'Add Dataset'))).click()
# Fill the requested information
self.fill_ds_general_info(pkg_name, 'Example description', ['tag1'], True, True, allowed_users, acquire_url)
# Check the error message
msg_error = WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.XPATH, '//div[@id=\'content\']/div[3]/div/section/div/form/div/ul/li'))).text
self.assertEqual(expected_msg, msg_error)
示例8: scenario_simple
# 需要导入模块: from selenium.webdriver.common.by import By [as 别名]
# 或者: from selenium.webdriver.common.by.By import LINK_TEXT [as 别名]
def scenario_simple(user):
driver = commons.login(user)
user.wait_for_element_present(By.ID, "start")
driver.find_element_by_id("start").click()
commons.fill_repo_info(driver, user, user.repo)
user.log("spawn clicked")
user.wait_for_element_present(By.LINK_TEXT, "Control Panel")
old_files = get_files(driver)
driver.find_element_by_link_text("Control Panel").click()
user.wait_for_element_present(By.ID, "stop")
driver.find_element_by_id("stop").click()
user.log("stop clicked")
user.wait_for_pattern_in_page(r"Launch\s+a\s+notebook")
driver.find_element_by_id("start").click()
commons.fill_repo_info(driver, user, 'https://github.com/everware/travis-test-repo')
user.log("spawn clicked (second time)")
user.wait_for_element_present(By.LINK_TEXT, "Control Panel")
new_files = get_files(driver)
assert old_files != new_files, """It's an old container:
Old elems: %s, New elems: %s
""" % (' '.join(old_files), ' '.join(new_files))
示例9: scenario_no_jupyter
# 需要导入模块: from selenium.webdriver.common.by import By [as 别名]
# 或者: from selenium.webdriver.common.by.By import LINK_TEXT [as 别名]
def scenario_no_jupyter(user):
driver = commons.login(user)
user.wait_for_element_present(By.ID, "start")
driver.find_element_by_id("start").click()
commons.fill_repo_info(driver, user, 'docker:busybox')
user.log("spawn clicked")
user.wait_for_element_present(By.ID, "resist")
user.log("correct, no jupyter in container")
driver.find_element_by_id("resist").click()
commons.fill_repo_info(driver, user, user.repo)
user.log("spawn clicked (second try)")
user.wait_for_element_present(By.LINK_TEXT, "Control Panel")
driver.find_element_by_link_text("Control Panel").click()
user.wait_for_element_present(By.ID, "stop")
driver.find_element_by_id("stop").click()
user.log("stop clicked")
user.wait_for_pattern_in_page(r"Launch\s+a\s+notebook")
driver.find_element_by_id("logout").click()
user.log("logout clicked")
示例10: click_text
# 需要导入模块: from selenium.webdriver.common.by import By [as 别名]
# 或者: from selenium.webdriver.common.by.By import LINK_TEXT [as 别名]
def click_text(self, text):
"""
Click the element by the link text
Usage:
self.click_text("新闻")
"""
find_element((By.LINK_TEXT, text))
Seldom.driver.find_element_by_link_text(text).click()
示例11: test06CreateNewProjectWithMinimalInput
# 需要导入模块: from selenium.webdriver.common.by import By [as 别名]
# 或者: from selenium.webdriver.common.by.By import LINK_TEXT [as 别名]
def test06CreateNewProjectWithMinimalInput(self):
self.login()
WebDriverWait(self.browser, 5).until(EC.visibility_of_element_located((By.XPATH, '//button[@title="upload data files"]')))
self.browser.find_element_by_xpath('//button[@title="upload data files"]').click()
WebDriverWait(self.browser, 5).until(EC.visibility_of_element_located((By.ID, 'uploadTitle')))
self.browser.find_element_by_id('uploadTitle').send_keys('test_project_minimal')
self.browser.find_element_by_id('uploadDescription').send_keys('description of test project')
self.browser.find_element_by_id('treeFileSelect').send_keys(self.BASEPATH+'tree.txt')
self.browser.find_element_by_id('dataFileSelect').send_keys(self.BASEPATH+'view_data.txt')
self.browser.find_element_by_id('uploadFiles').click()
WebDriverWait(self.browser, 5).until(EC.presence_of_element_located((By.LINK_TEXT, 'test_project_minimal')))
self.assertTrue(self.browser.find_element_by_link_text('test_project_minimal'))
示例12: test07SelectProject
# 需要导入模块: from selenium.webdriver.common.by import By [as 别名]
# 或者: from selenium.webdriver.common.by.By import LINK_TEXT [as 别名]
def test07SelectProject(self):
self.login()
WebDriverWait(self.browser, 5).until(EC.presence_of_element_located((By.LINK_TEXT, 'test_project_with_all_files')))
self.browser.find_element_by_link_text('test_project_with_all_files').click()
WebDriverWait(self.browser, 5).until(EC.title_is('test_project_with_all_files'))
self.assertIn('test_project_with_all_files', self.browser.title)
示例13: test11DeleteUser
# 需要导入模块: from selenium.webdriver.common.by import By [as 别名]
# 或者: from selenium.webdriver.common.by.By import LINK_TEXT [as 别名]
def test11DeleteUser(self):
self.loginAdmin()
WebDriverWait(self.browser, 5).until(EC.presence_of_element_located((By.LINK_TEXT, 'admin page')))
self.browser.find_element_by_link_text('admin page').click()
WebDriverWait(self.browser, 5).until(EC.presence_of_element_located((By.XPATH, '//button[@onclick="showUserDetails(\'testuser2\');"]')))
self.browser.find_element_by_xpath('//button[@onclick="showUserDetails(\'testuser2\');"]').click()
WebDriverWait(self.browser, 5).until(EC.presence_of_element_located((By.XPATH, '//button[@onclick="deleteUser(\'testuser2\')"]')))
self.browser.find_element_by_xpath('//button[@onclick="deleteUser(\'testuser2\')"]').click()
WebDriverWait(self.browser, 5).until(EC.alert_is_present())
Alert(self.browser).send_keys('CONFIRM')
Alert(self.browser).accept()
WebDriverWait(self.browser, 5).until(EC.presence_of_element_located((By.ID, 'usertable')))
self.assertFalse(len(self.browser.find_elements_by_xpath('//button[@onclick="showUserDetails(\'testuser2\');"]')))
示例14: go_to_transform
# 需要导入模块: from selenium.webdriver.common.by import By [as 别名]
# 或者: from selenium.webdriver.common.by.By import LINK_TEXT [as 别名]
def go_to_transform(self):
# Click in the top menu
self.selenium.find_element_by_id('ontask-base-table').click()
# Wait for the Full View to be clickable
WebDriverWait(self.selenium, 10).until(
EC.element_to_be_clickable(
(By.LINK_TEXT, 'Run Transformation')
)
)
# Click on the upload and wait...
self.selenium.find_element_by_link_text('Run Transformation').click()
self.wait_for_datatable('transform-table_previous')
示例15: go_to_model
# 需要导入模块: from selenium.webdriver.common.by import By [as 别名]
# 或者: from selenium.webdriver.common.by.By import LINK_TEXT [as 别名]
def go_to_model(self):
# Click in the top menu
self.selenium.find_element_by_id('ontask-base-table').click()
# Wait for the Full View to be clickable
WebDriverWait(self.selenium, 10).until(
EC.element_to_be_clickable(
(By.LINK_TEXT, 'Run Model')
)
)
# Click on the upload and wait...
self.selenium.find_element_by_link_text('Run Model').click()
self.wait_for_datatable('transform-table_previous')