__st__.py 1.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
import sys
import os
from time import sleep

# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..'))
# 添加路径
sys.path.append(预定系统_path)
# 导入模块
try:
    from 预定系统.Base.base import *
except ModuleNotFoundError as e:
    print(f"ModuleNotFoundError: {e}")
    print("尝试使用绝对路径导入")
    from 预定系统.Base.base import *

def suite_setup():
    STEP(1, "初始化浏览器")
21 22
    # 传入系统类型,展厅运维巡检 == 192.168.5.200
    browser_init("展厅运维巡检")
23 24 25 26 27 28 29 30 31 32 33 34

    wd = GSTORE['wd']
    STEP(2, "登录系统")
    safe_send_keys((By.XPATH, "//input[@placeholder='请输入登录账号']"),"admin@pgy",wd)
    safe_send_keys((By.XPATH, "//input[@placeholder='请输入登录密码']"),"ub123456",wd)
    safe_send_keys((By.XPATH, "//input[@placeholder='请输入验证码(区分大小写)']"),"csba",wd)
    sleep(2)
    safe_click((By.XPATH, "//div[@class='loginButton']"),wd)
    INFO("请查看运维系统首页")

def suite_teardown():
    browser_quit()