1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import sys
import os
from hytest.common import SELENIUM_LOG_SCREEN
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
class Userquery:
name = '查询用户-001-精确查询用户'
def teststeps(self):
wd = GSTORE['wd']
STEP(1, '点击搜索框')
user_query = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//input[@placeholder='请输入名称']"))
)
user_query.click()
STEP(2, '填写登录名')
account_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='请输入名称']"))
)
account_input.clear()
account_input.send_keys("test_user1")
STEP(3, '校验是否成功检索用户')
get_user = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//div[normalize-space()='test_user1']"))
)
get_username = get_user.text
CHECK_POINT('校验是否成功检索用户', get_username == "test_user1")
# 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
wd.refresh()