本文整理汇总了Python中selenium.webdriver.support.expected_conditions.visibility_of_element_located函数的典型用法代码示例。如果您正苦于以下问题:Python visibility_of_element_located函数的具体用法?Python visibility_of_element_located怎么用?Python visibility_of_element_located使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了visibility_of_element_located函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: click_batch_keyword_apply_link
def click_batch_keyword_apply_link(self):
"""
Clicks Batch Keyword Apply link.
"""
self._wait.until(ec.visibility_of_element_located(self._batch_keyword_apply_link))
click_element(self._driver, self._driver.find_element(*self._batch_keyword_apply_link))
self._wait.until(ec.visibility_of_element_located(self._collection_modal))
示例2: test_TL_003_timeline_settings_add_new_tags
def test_TL_003_timeline_settings_add_new_tags(self):
"""
Test : test_FI_003 To verify that new tags added properly.
Description : .
Revision:
Author : Bijesh
:return: None
"""
self.timelinepage.get_time_line_settings_link.click()
WebDriverWait(self.driver, 20).until(EC.visibility_of_element_located((By.XPATH,
self.timelinepage._tl_settings_window_header_locator)))
tag_count = 0
try:
if len(self.timelinepage.get_tl_settings_window_tags_delete_link)>=1:
tag_count = len(self.timelinepage.get_tl_settings_window_tags_delete_link)
except:
pass
self.timelinepage.get_tl_settings_window_start_date_textbox.clear()
self.timelinepage.get_tl_settings_window_start_date_textbox.send_keys(self.timelinepage.time_line_start_date)
self.timelinepage.get_tl_settings_window_end_date_textbox.clear()
self.timelinepage.get_tl_settings_window_end_date_textbox.send_keys(self.timelinepage.time_line_end_date)
self.timelinepage.get_tl_settings_window_tags_textbox.send_keys(self.timelinepage.time_line_tag_1)
self.timelinepage.get_tl_settings_window_tags_add_button.click()
self.timelinepage.get_tl_settings_window_save_button.click()
sleep(2)
self.timelinepage.get_time_line_settings_link.click()
WebDriverWait(self.driver, 20).until(EC.visibility_of_element_located((By.XPATH,
self.timelinepage._tl_settings_window_header_locator)))
tag_count_final = len(self.timelinepage.get_tl_settings_window_tags_delete_link)
sleep(1)
self.timelinepage.delete_all_tags()
sleep(2)
self.timelinepage.get_tl_settings_window_save_button.click()
sleep(2)
self.assertEqual(tag_count_final, tag_count+1,"New tag could not be added.")
示例3: login
def login(driver):
print('Logging in into %s ...' % EDIT_URL)
driver.get(EDIT_URL)
print('...')
elem = WebDriverWait(driver, 30).until(
EC.visibility_of_element_located((By.NAME, 'Email'))
)
elem.send_keys(LOGIN)
try:
# two-field login
elem = driver.find_element_by_name('Passwd')
elem.send_keys(PASS)
except NoSuchElementException:
# single-field login
elem.send_keys(Keys.ENTER)
elem = WebDriverWait(driver, 30).until(
EC.visibility_of_element_located((By.NAME, 'Passwd'))
)
elem.send_keys(PASS)
elem.send_keys(Keys.ENTER)
print('Submitting ...')
WebDriverWait(driver, 30).until(lambda x: x.title[-len(EDIT_TITLE):] == EDIT_TITLE)
print('...')
示例4: setup_prevalence_chart
def setup_prevalence_chart(self, disease_progression_name, points, timeout=None):
"""Sets up the prevalence chart for the given Disease Progression. Returns the name of the relational function
that contains the prevalence chart."""
if timeout is None:
timeout = self.default_timeout
self.click_navbar_element('Disease Progression')
# Once the Disease Progression choices come up, click the desired one
WebDriverWait(self.selenium, timeout=timeout).until(
EC.visibility_of_element_located((By.LINK_TEXT, disease_progression_name))
).click()
# Once the latent period, etc. options come up, click to bring up the prevalence chart
prevalence_options = WebDriverWait(self.selenium, timeout=timeout).until(
EC.visibility_of_element_located((By.ID, 'id_disease_prevalence'))
)
prevalence_name = Select(prevalence_options).first_selected_option.text # remember its name
prevalence_options.click()
# Once the prevalence chart comes up, overwrite the old points with the new ones.
FunctionsPanel(
WebDriverWait(self.selenium, timeout=timeout).until(
EC.visibility_of_element_located((By.ID, 'functions_panel'))
)
).set_points(points)
return prevalence_name
示例5: test_TL_004_timeline_settings_add_new_tag_wrong_value
def test_TL_004_timeline_settings_add_new_tag_wrong_value(self):
"""
Test : test_FI_004 To verify that time line does not have any info if wrong tags has been added.
Description : .
Revision:
Author : Bijesh
:return: None
"""
self.timelinepage.get_time_line_settings_link.click()
WebDriverWait(self.driver, 20).until(EC.visibility_of_element_located((By.XPATH,
self.timelinepage._tl_settings_window_header_locator)))
self.timelinepage.get_tl_settings_window_start_date_textbox.clear()
self.timelinepage.get_tl_settings_window_start_date_textbox.send_keys(self.timelinepage.time_line_start_date)
self.timelinepage.get_tl_settings_window_end_date_textbox.clear()
self.timelinepage.get_tl_settings_window_end_date_textbox.send_keys(self.timelinepage.time_line_end_date)
self.timelinepage.get_tl_settings_window_tags_textbox.send_keys(self.timelinepage.time_line_tag_2)
self.timelinepage.get_tl_settings_window_tags_add_button.click()
check_boxes_name = ["assessments","events","incidents", "field_interviews"]
for item in check_boxes_name:
self.timelinepage.check_box_enable(item)
self.timelinepage.get_tl_settings_window_save_button.click()
sleep(2)
time_line_info = len(self.timelinepage.get_time_line_all_images)
self.timelinepage.get_time_line_settings_link.click()
WebDriverWait(self.driver, 20).until(EC.visibility_of_element_located((By.XPATH,
self.timelinepage._tl_settings_window_header_locator)))
self.timelinepage.delete_all_tags()
sleep(2)
self.timelinepage.get_tl_settings_window_save_button.click()
sleep(2)
self.assertEqual(time_line_info, 1, "Tag could not be added properly.")
示例6: click_rectangle_button
def click_rectangle_button(self):
"""
Clicks rectangle button.
"""
if not is_element_present(self._driver, *self._rectangle_selected_button):
self._wait.until(ec.visibility_of_element_located(self._rectangle_button)).click()
self._wait.until(ec.visibility_of_element_located(self._rectangle_selected_button))
示例7: wait_to_appear
def wait_to_appear(self, item):
"""Wait for item to appear
* If there are no spaces in item, waits for element with HTML id "item" to appear.
* "first class1" - waits for first item with HTML class "class1" to appear.
* "2nd class1 class2" - waits for the 2nd item with HTML classes class1 and class2 to appear.
* "last class1 class2" - waits for the last element with classes class1 and class2 to appear.
"""
item = HitchSeleniumItem(item)
if item.is_id:
WebDriverWait(self.driver, self.wait_for_timeout).until(
EC.visibility_of_element_located((By.ID, item.html_id))
)
else:
full_xpath = """//*[{}][{}]""".format(
" and ".join([
"""contains(concat(' ', normalize-space(@class), ' '), ' {} ')""".format(
class_name
) for class_name in item.html_classes]
),
str(item.index + 1) if item.index >= 0 else "last()"
)
WebDriverWait(self.driver, self.wait_for_timeout).until(
EC.visibility_of_element_located((By.XPATH, full_xpath))
)
示例8: test_shows_patient_data
def test_shows_patient_data(self):
"""
Test that a patient record shows data (graph/table) for the patient
"""
patients = self.patient_list_page.get_list_items()
PatientPage(self.driver).select_patient(patients)
ui.WebDriverWait(self.driver, 1).until(
ec.visibility_of_element_located(patient_page_locators.GRAPH_CHART)
)
patient_graph = self.driver.find_element(*
patient_page_locators
.GRAPH_CHART)
self.assertEqual(patient_graph.is_displayed(), True, 'Graph not found')
self.driver.find_element(*patient_page_locators
.TABLE_TAB_BUTTON).click()
ui.WebDriverWait(self.driver, 1).until(
ec.visibility_of_element_located
(patient_page_locators.TABLE_CONTAINER_TABLE))
patient_table = self.driver.find_element(*
patient_page_locators
.TABLE_CONTAINER_TABLE)
self.assertEqual(patient_table.is_displayed(), True, 'Table not found')
示例9: submit_empty_form
def submit_empty_form(expected_data):
def _assert_has_no_errors():
assert expected_data == output_data
Arsenic().find_element_by_xpath('//button[@class="btn btn-success form-submit"]').click()
try:
WebDriverWait(Arsenic(), 10).until(
EC.visibility_of_element_located((By.ID, 'state-given_names'))
)
WebDriverWait(Arsenic(), 10).until(
EC.visibility_of_element_located((By.ID, 'state-display_name'))
)
WebDriverWait(Arsenic(), 10).until(
EC.visibility_of_element_located((By.ID, 'state-research_field'))
)
output_data = {
'given-name': Arsenic().find_element_by_id(
'state-given_names'
).text,
'display-name': Arsenic().find_element_by_id(
'state-display_name'
).text,
'reserach-field': Arsenic().find_element_by_id(
'state-research_field'
).text
}
except (ElementNotVisibleException, WebDriverException):
output_data = {}
return ArsenicResponse(assert_has_no_errors_func=_assert_has_no_errors)
示例10: add_students_bulk
def add_students_bulk(driver, users):
'''Add students to a recently created contest.'''
driver.wait.until(
EC.element_to_be_clickable(
(By.CSS_SELECTOR,
('li.contestants > a')))).click()
driver.wait.until(
EC.visibility_of_element_located(
(By.CSS_SELECTOR, 'div.contestants')))
driver.wait.until(
EC.visibility_of_element_located(
(By.XPATH, (
'//textarea[contains(@class, "contestants")]')))).send_keys(
', '.join(users))
driver.wait.until(
EC.element_to_be_clickable(
(By.CLASS_NAME, ('user-add-bulk')))).click()
for user in users:
driver.wait.until(
EC.visibility_of_element_located(
(By.XPATH,
'//table[contains(@class, "participants")]//a[text()="%s"]'
% user)))
示例11: _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"]))
示例12: test_missing_exchange
def test_missing_exchange(exchange, browser, port, class_files, tempdir):
# remove the exchange directory and fetched assignments
rmtree(exchange)
rmtree(os.path.join(tempdir, "Problem Set 1"))
_load_assignments_list(browser, port)
_wait_until_loaded(browser)
# make sure all the errors are showing
_wait(browser).until(EC.visibility_of_element_located((By.CSS_SELECTOR, "#released_assignments_list_error")))
_wait(browser).until(EC.visibility_of_element_located((By.CSS_SELECTOR, "#fetched_assignments_list_error")))
_wait(browser).until(EC.visibility_of_element_located((By.CSS_SELECTOR, "#submitted_assignments_list_error")))
# verify that the dropdown list shows an error too
default = browser.find_element_by_css_selector("#course_list_default")
assert default.text == "Error fetching courses!"
# recreate the exchange and make sure refreshing works as expected
os.makedirs(exchange)
# release an assignment
run_nbgrader(["assign", "Problem Set 1", "--force"])
run_nbgrader(["release", "Problem Set 1", "--course", "abc101", "--force"])
# click the refresh button
browser.find_element_by_css_selector("#refresh_assignments_list").click()
_wait_until_loaded(browser)
# wait for the released assignments to update
rows = _wait_for_list(browser, "released", 1)
assert rows[0].find_element_by_class_name("item_name").text == "Problem Set 1"
assert rows[0].find_element_by_class_name("item_course").text == "abc101"
示例13: click_batch_image_order_link
def click_batch_image_order_link(self):
"""
Clicks Batch Image Order link.
"""
self._wait.until(ec.visibility_of_element_located(self._batch_image_order_link))
click_element(self._driver, self._driver.find_element(*self._batch_image_order_link))
self._wait.until(ec.visibility_of_element_located(self._collection_modal))
示例14: click_download_archive_of_fpos_link
def click_download_archive_of_fpos_link(self):
"""
Clicks Download Archive of FPOs link.
"""
self._wait.until(ec.visibility_of_element_located(self._download_archive_of_fpos_link))
click_element(self._driver, self._driver.find_element(*self._download_archive_of_fpos_link))
self._wait.until(ec.visibility_of_element_located(self._collection_modal))
示例15: CreatePage
def CreatePage(driver, stackURL, cell):
pageName = excelSheet[cell].value
typePage = DeterminePage(driver, cell)
testID = "ctl00_ContentPlaceHolder1_ctl00_ctl00_menu_m2"
#testID = GetID(driver, "ctl00_ContentPlaceHolder1_ctl00_ctl00_menu_m2", True)
WebDriverWait(driver, 10).until(ec.visibility_of_element_located((By.ID, testID)))
driver.find_element_by_id(testID).click()
if(typePage == "Content"): num = "6"
else: num = "7"
testID = "ctl00_ContentPlaceHolder1_ctl00_ctl00_menu_m2_m" + num
#testID = GetID(driver,"ctl00_ContentPlaceHolder1_ctl00_ctl00_menu_m2_m" + num, True)
WebDriverWait(driver, 10).until(ec.visibility_of_element_located((By.ID, testID)))
driver.find_element_by_id(testID).click()
WebDriverWait(driver, 10).until(ec.visibility_of_element_located((By.ID, GetID(driver, "ctl00_ContentPlaceHolder1_ctl00_txtTitle", False))))
input = driver.find_element_by_id(GetID(driver, "ctl00_ContentPlaceHolder1_ctl00_txtTitle", False))
input.send_keys(pageName)
print(typePage)
if(typePage == "Content"):
CreateContentPage(driver, stackURL, cell)
elif(typePage == "External"):
CreateLinkPage(driver, stackURL, cell)
elif(typePage == "File"):
CreateFilePage(driver, stackURL, cell)