通过selenium自动输入验证码登录,判断点击“登录”后是否登录成功;如果没登陆成功,则进行循环登录。
由于验证码定位、截图、识别,已经在前面实现,这里只记录自己判断是否登录成功的一种方法;
(selenium里看了下没有现成的功能--判断是否登录成功)
如上图,登录失败的话,会出现 “图形验证码不正确” 字样,根据它在html页面里的xpath,定位到位置所在;
执行登录后,如果当前html页面中存在这个xpath,那么就表示登录失败。