本文整理汇总了Python中tests.front_office.not_sorted.classes.class_navigate.HelpNavigateCheckMethods.get_page方法的典型用法代码示例。如果您正苦于以下问题:Python HelpNavigateCheckMethods.get_page方法的具体用法?Python HelpNavigateCheckMethods.get_page怎么用?Python HelpNavigateCheckMethods.get_page使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.front_office.not_sorted.classes.class_navigate.HelpNavigateCheckMethods
的用法示例。
在下文中一共展示了HelpNavigateCheckMethods.get_page方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_user_to_contacts
# 需要导入模块: from tests.front_office.not_sorted.classes.class_navigate import HelpNavigateCheckMethods [as 别名]
# 或者: from tests.front_office.not_sorted.classes.class_navigate.HelpNavigateCheckMethods import get_page [as 别名]
def set_user_to_contacts(driver, link_db, current_count, need_count=20, mode='all'):
"""
Наполнить список контактов пользователями
:param driver:
:return:
"""
user_added = list()
count_add_users = 0
fail = 0
service_log.put("Start filling the contact list")
diff_count = need_count-current_count
if diff_count <= 0:
service_log.put("Contact list is full!")
else:
users_list = HelpUserContactsMethods.add_users_strategy(link_db, mode)
random.shuffle(users_list)
for user in users_list:
result = HelpUserContactsMethods.click_in_contact(driver, user["account_details_id"])
if result is True:
count_add_users += 1
user_added.append(user["account_details_id"])
service_log.put("Add user='%s' to contact list" % user["account_details_id"])
else:
fail += 1
assert fail == 50, "Пользователи не добавляются."
if diff_count == count_add_users:
service_log.put("End filling the contact list")
Navigate.get_page(driver, Navigate.path_user_contact.URL_FAVORITES_USERS)
break
return user_added
示例2: get_back_page
# 需要导入模块: from tests.front_office.not_sorted.classes.class_navigate import HelpNavigateCheckMethods [as 别名]
# 或者: from tests.front_office.not_sorted.classes.class_navigate.HelpNavigateCheckMethods import get_page [as 别名]
def get_back_page(driver, env_back_url=MainClass.ENV_BASE_BACK_URL, path_back=''):
"""
Перход на страницу бек-офиса по path
:param driver:
:param env_back_url:
:param path_back:
:return:
"""
HNCK.get_page(driver=driver, path_url=path_back, env_base_url=env_back_url)
示例3: get_page_with_param
# 需要导入模块: from tests.front_office.not_sorted.classes.class_navigate import HelpNavigateCheckMethods [as 别名]
# 或者: from tests.front_office.not_sorted.classes.class_navigate.HelpNavigateCheckMethods import get_page [as 别名]
def get_page_with_param(driver, url_path, param):
"""
Выполнить переход на страницу по урлу с параметром (например подставить идентификатор магазина)
:param driver:
:param url_path:
:param param:
:return:
"""
url = url_path + param
Navigate.get_page(driver, url)
示例4: go_main
# 需要导入模块: from tests.front_office.not_sorted.classes.class_navigate import HelpNavigateCheckMethods [as 别名]
# 或者: from tests.front_office.not_sorted.classes.class_navigate.HelpNavigateCheckMethods import get_page [as 别名]
def go_main(driver, phone=None, email=None, passwd=None, flag_auth=True, flag_api=True):
""" Универсальный переход на главную страницу.
:param driver: ссылка на драйвер
:param phone: номер телефона
:param email: электронная почта
:param passwd: пароль
:param flag_auth: флаг авторизации
"""
from support.utils.variables import EVariable
env_base_url = EVariable.front_base.url.strip()
# авторизоваться через API
if flag_auth:
service_log.put("To authorization via API")
if flag_api:
if email is None and phone is not None:
HelpAuthMethods.set_authorization_by_phone(driver, phone, passwd)
elif email is not None and phone is None:
# TODO
pass
else:
msg_error = "Not correct params."
service_log.error(msg_error)
assert AssertionError(msg_error)
else:
if email is None and phone is not None:
HelpNavigateCheckMethods.get_page(driver, HelpNavigateCheckMethods.path_auth.PATH_AUTH)
obj_phone, obj_password, obj_submit_button = HelpAuthCheckMethods.get_data_authorization(driver)
# Вводим данные на авторизацию
l = lambda e, p:e if p is None else p
HelpAuthCheckMethods.send_phone(phone_object=obj_phone, phone_number=l(email, phone))
HelpAuthCheckMethods.send_password(password_object=obj_password, password_number=passwd)
# Нажатие на кнопку авторизации
HelpNavigateCheckMethods.element_click(driver, obj_submit_button, change_page_url=True)
time.sleep(HelpNavigateCheckMethods.time_sleep)
elif email is not None and phone is None:
# TODO
pass
else:
msg_error = "Not correct params."
service_log.error(msg_error)
assert AssertionError(msg_error)
service_log.put("To authorization via API - success.")
service_log.put("Get page: %s" % env_base_url)
do_get_work = time.time()
driver.get(env_base_url)
work_get_time = HelpNavigateCheckMethods.work_time(do_get_work)
service_log.put("Onload event time: [%s]" % work_get_time)
HelpNavigateCheckMethods.progress(driver)
work_load_time = HelpNavigateCheckMethods.work_time(do_get_work)
service_log.put("Page received: %s" % env_base_url)
service_log.put("Page received time: %s" % work_load_time)
time.sleep(3)
示例5: check_delete_first_user_in_cl
# 需要导入模块: from tests.front_office.not_sorted.classes.class_navigate import HelpNavigateCheckMethods [as 别名]
# 或者: from tests.front_office.not_sorted.classes.class_navigate.HelpNavigateCheckMethods import get_page [as 别名]
def check_delete_first_user_in_cl(self, driver, user_id, fav_usr, link_db):
fav_users_list_old = link_db.accounting.get_fav_user_in_cl_user(user_id, fav_usr["id"])
self.assertNotEqual(len(fav_users_list_old), 0 , "Пользователя нет в БД контактах")
self.delete_first_user_in_cl(driver, fav_usr)
fav_users_list_new = link_db.accounting.get_fav_user_in_cl_user(user_id, fav_usr["id"])
self.assertEqual(len(fav_users_list_new), 0, "Пользователь есть в БД контактах: '%s'" % fav_users_list_new)
HelpUserContactsCheckMethods.check_user_no_in_cl(self, driver, fav_usr["id"])
driver.refresh()
Navigate.progress(driver)
HelpUserContactsCheckMethods.check_user_no_in_cl(self, driver, fav_usr["id"])
Navigate.get_page(driver, Navigate.path_buyer.URL_BUYER % fav_usr["id"])
Navigate.get_element_navigate(driver, Navigate.click_user_contact.IN_CONTACT_USER, sleep=0.1, mode=None)
driver.back()
示例6: click_in_contact
# 需要导入模块: from tests.front_office.not_sorted.classes.class_navigate import HelpNavigateCheckMethods [as 别名]
# 或者: from tests.front_office.not_sorted.classes.class_navigate.HelpNavigateCheckMethods import get_page [as 别名]
def click_in_contact(driver, user_id):
""" Нажимаем кнопку в контакты.
:param driver: ссылка на драйвер
:param user_id: идентификатор пользователя
:return: type(bool)
"""
result = False
try:
Navigate.get_page(driver, Navigate.path_buyer.URL_BUYER % user_id)
in_contact = Navigate.click_user_contact.IN_CONTACT_USER
btn = Navigate.get_element_navigate(driver, in_contact, sleep=0.1, mode=None)
HelpAuthCheckMethods.click_button(btn, sleep=0.1)
result = True
except Exception:
result = False
return result
示例7: delete_user_in_contacts
# 需要导入模块: from tests.front_office.not_sorted.classes.class_navigate import HelpNavigateCheckMethods [as 别名]
# 或者: from tests.front_office.not_sorted.classes.class_navigate.HelpNavigateCheckMethods import get_page [as 别名]
def delete_user_in_contacts(driver, link_db, user_id):
"""
Удалить пользователей из списка контактов
:param driver:
:param count:
:return:
"""
Navigate.get_page(driver, Navigate.path_user_contact.URL_FAVORITES_USERS)
fav_users_list = link_db.accounting.get_fav_user_by_user_id(user_id)
l = lambda l: list() if l is None else l
count = len(l(fav_users_list))
while count != 0:
btn_user = Navigate.get_element_navigate(driver, Navigate.click_user_contact.LAST_USER, sleep=1)
HelpAuthCheckMethods.click_button(btn_user, sleep=0.1)
btn_delete = Navigate.get_element_navigate(driver, Navigate.click_user_contact.BTN_DELETE, sleep=0.1)
HelpAuthCheckMethods.click_button(btn_delete, sleep=1)
fav_users_list = link_db.accounting.get_fav_user_by_user_id(user_id)
count = len(l(fav_users_list))
示例8: check_main_menu_to_url
# 需要导入模块: from tests.front_office.not_sorted.classes.class_navigate import HelpNavigateCheckMethods [as 别名]
# 或者: from tests.front_office.not_sorted.classes.class_navigate.HelpNavigateCheckMethods import get_page [as 别名]
def check_main_menu_to_url(self, driver, link_map, role, param=None):
"""
Проверка наличия меню на страницах сайта путем перехода по урлу
:param driver:
:param role:
:return:
"""
service_log.put("Checking role -> '%s'" % role)
menu = lambda x, d, m: Navigate.get_element_navigate(d, m) if x is True else Navigate.element_is_none(d, m)
url = lambda par, sm, p: sm[p] if par is None else sm[p] % par[p]
page_map = link_map[role]
for page in page_map:
service_log.put("Checking...['%s']" % page)
source = driver.page_source
url_page = url(param, self.SITE_MAP, page)
Navigate.get_page(driver, url_page)
source_new = driver.page_source
err_msg = "Переход по урлу='%s' не произошел, содержимое страницы не изменилось"
self.assertNotEqual(source, source_new, err_msg % url)
menu(page_map[page], driver, self.xpath_menu)
service_log.put("PASS...['%s']" % page)
service_log.put("Checked role -> '%s'" % role)
示例9: setUp
# 需要导入模块: from tests.front_office.not_sorted.classes.class_navigate import HelpNavigateCheckMethods [as 别名]
# 或者: from tests.front_office.not_sorted.classes.class_navigate.HelpNavigateCheckMethods import get_page [as 别名]
def setUp(cls):
# Подготовка работы с selenium
cls.driver = cls.get_driver()
Navigate.get_page(cls.driver, Navigate.path_reg.URL_REG)
cls.click_to_phone(cls.driver)
service_log.preparing_env(cls)