1.测试用例
2.代码 示例
from selenium import webdriver from selenium.webdriver.common.by import By # 隐式等待 driver = webdriver.Chrome() driver.get('http://127.0.0.1/mgr/sign.html') driver.implicitly_wait(5) # 登录测试 driver.find_element(By.ID,'username').send_keys('byhy') driver.find_element(By.ID,'password').send_keys('88888888') driver.find_element(By.CLASS_NAME,'btn-primary').click() # 获取左侧菜单 UL = driver.find_element(By.CLASS_NAME,'sidebar-menu') spans = UL.find_elements(By.TAG_NAME,'span') menutatle = [] for span in spans: print(span.text) menutatle.append(span.text) # 检查菜单信息 if menutatle[:3] == ['客户','药品','订单']: print('测试通过') else: print('测试不通过')