本文整理汇总了Python中tests.front_office.not_sorted.classes.class_navigate.HelpNavigateCheckMethods.elements_is_present方法的典型用法代码示例。如果您正苦于以下问题:Python HelpNavigateCheckMethods.elements_is_present方法的具体用法?Python HelpNavigateCheckMethods.elements_is_present怎么用?Python HelpNavigateCheckMethods.elements_is_present使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.front_office.not_sorted.classes.class_navigate.HelpNavigateCheckMethods
的用法示例。
在下文中一共展示了HelpNavigateCheckMethods.elements_is_present方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pagination
# 需要导入模块: from tests.front_office.not_sorted.classes.class_navigate import HelpNavigateCheckMethods [as 别名]
# 或者: from tests.front_office.not_sorted.classes.class_navigate.HelpNavigateCheckMethods import elements_is_present [as 别名]
def pagination(self, driver, count, section_xpath, items_in_page=40, e_msg=''):
"""
Проверка пагинации
:param driver:
:param count:
:param section_xpath:
:param e_msg:
:return:
"""
current_page = 1
all_pages = int(math.ceil(int(count) / (items_in_page + 0.0)))
remaining_pages = all_pages - current_page
if remaining_pages == 0:
Navigate.element_is_none(driver, Navigate.click_search.PAG_PAGE % current_page)
obj_on_page = Navigate.elements_is_present(driver, section_xpath)
on_page = len(obj_on_page)
self.assertEqual(count, on_page, e_msg)
elif remaining_pages >= 1:
count_on_pages = 0
while remaining_pages >= 0:
obj_on_page = Navigate.elements_is_present(driver, section_xpath)
on_page = len(obj_on_page)
next_page = current_page + 1
if remaining_pages != 0:
self.assertEqual(items_in_page, on_page, e_msg)
Navigate.element_click(driver, Navigate.click_search.PAG_PAGE % next_page)
else:
self.assertEqual(count-count_on_pages, on_page, e_msg)
count_on_pages += on_page
current_page += 1
remaining_pages -= 1
self.assertEqual(count, count_on_pages, e_msg)
else:
self.assertGreaterEqual(remaining_pages, 0, "Кол-во оставшихся страниц [%s] отрицательно" % remaining_pages)
示例2: reading_unread_messages_after_reg
# 需要导入模块: from tests.front_office.not_sorted.classes.class_navigate import HelpNavigateCheckMethods [as 别名]
# 或者: from tests.front_office.not_sorted.classes.class_navigate.HelpNavigateCheckMethods import elements_is_present [as 别名]
def reading_unread_messages_after_reg(driver, new_messages):
"""
Прочитать(протыкать) все непрочитанные сообщения(диалоги с пользователями)
:param driver:
:return:
"""
dialogs = Navigate.elements_is_present(driver, Navigate.click_chat.ALL_UNREAD_MESSAGES)
for dialog in dialogs:
body_msg = Navigate.element_is_present(driver, Navigate.check_chat.LAST_MSG)
Navigate.element_is_present(driver, Navigate.check_main.COUNT_NEW_MSG % (new_messages-1), wait=20)
Navigate.element_click(driver, dialog, change_page_url=True)
body_msg_new = Navigate.get_element_navigate(driver, Navigate.check_chat.LAST_MSG)
assert body_msg != body_msg_new, "Тело нового диалога не появилось, переход на новый диалог не произошел"
msg = Navigate.get_element_navigate(driver, Navigate.check_main.ABSTRACT_MSG)
msg = msg.text.encode('utf-8')
return msg