def test_01(self):
'''前面输入账号密码,让正确运行到assert这一步,断言故意设置为False不成功'''
try:
self.driver.find_element_by_id("input1").send_keys(u"啊啊啊")
self.driver.find_element_by_id("input2").send_keys("xxx")
# 登录id是错的,定位会抛异常
self.driver.find_element_by_id("signin").click()
time.sleep(3)
locator = ("id", "lnk_current_user")
result = EC.text_to_be_present_in_element(locator,u"上海-悠悠")(self.driver)
self.assertFalse(result)
except Exception as msg:
print(u"异常原因%s"%msg)
# 图片名称可以加个时间戳
nowTime = time.strftime("%Y%m%d.%H.%M.%S")
self.driver.get_screenshot_as_file('%s.jpg' % nowTime)
raise