#encoding:utf-8
from find_element.capabilityimport driver
from selenium.webdriver.support.uiimport WebDriverWait
#启动APP 等待密码登录 进入短信登录页面
WebDriverWait(driver,3).until(lambda x:x.find_element_by_id("com.systoon.iningde:id/et_phone_num"))
driver.find_element_by_xpath("//*[@text='短信登录']").click()
#短信登录
driver.find_element_by_id("com.systoon.iningde:id/et_phone_num").clear()
driver.find_element_by_id("com.systoon.iningde:id/et_phone_num").send_keys("15313226821")
driver.find_element_by_xpath("//*[@text='获取验证码']").click()
driver.find_element_by_xpath("//*[@text='请输入验证码']").send_keys("1111")
driver.find_element_by_xpath("//*[@text='登录']").click()
# driver.find_element_by_xpath("登录").click()
#匹配toast
error_message="验证码错误,请重新输入"
limit_message="验证码错误次数超限,请在1小时后重试"
# message = "//*[@text=\'{}\']".format(error_message)
message ="//*[@text=\'{}\']".format(limit_message)
toast_message = WebDriverWait(driver,2).until(lambda x:x.find_element_by_xpath(message))
print(toast_message.text)
网友评论