selenium验证码和错误截图
验证码的识别:
1,破解验证码
OCR识别(一般使用tesseract-ocr)
人工智能(AI机器学习 TensorFlow,成本大)
2,绕过验证码
1, 让开发人员临时关闭验证码
2,提供万能验证码(需要保密,一般在开发测试环境使用)
3,使用cookies(登录注意是为了拿到cookies,获取登录凭证)
- # -*- coding:UTF-8 -*-
- __autor__ = 'zhouli'
- __date__ = '2018/11/6 20:49'
- from selenium import webdriver
- driver = webdriver.Chrome()
- driver.get('************0')
- driver.add_cookie({'name':'token', 'value':'*************'})
- # 用add_cookie以字典的方式进行添加cookie,即可绕过登录
错误截图:
- # -*- coding:UTF-8 -*-
- __autor__ = 'zhouli'
- __date__ = '2018/11/6 21:04'
- from selenium import webdriver
- from selenium.webdriver.common.action_chains import ActionChains
- driver = webdriver.Chrome()
- driver.get('www.baidu.com')
- # 查找登录框
- login_ele = driver.find_element_by_id("#login")
- # 触发事件,故意写错
- ActionChains(driver).click(login_ele).perform()
- # 捕捉不到元素异常
- try:
- driver.find_element_by_id("xdclass").click()
- except:
- driver.get_screenshot_as_file('./error.png') # get_screenshot_as_file
selenium验证码和错误截图的更多相关文章
- Think PHP 提示验证码输入错误
最近遇到一个项目中用的是Thinkphp这个框架开发的,其中在登录这块有验证码这个功能,其实这个功能是TP自带的,其中主要方法是buildImageVerify,位于ThinkPHP\Extend\L ...
- selenium 运行之后错误提示Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output
错误提示: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port ...
- 《selenium2 python 自动化测试实战》(19)——webdriver错误截图
webdriver 提供错误截图函数 get_screenshot_as_file(),可以帮助我们跟踪 bug,在脚本无法继续执行时候, get_screenshot_as_file()函数将截取当 ...
- unittest框架,漂亮的报告BeautifulReport配置与错误截图详细解说
1.下载BeautifulReport模块 下载地址:https://github.com/TesterlifeRaymond/BeautifulReport 2.解压与存放路径 下载Beautifu ...
- selenium web driver 实现截图功能
在验证某些关键步骤时,需要截个图来记录一下当时的情况 Webdriver截图时,需要引入 import java.io.File; import java.io.IOException; import ...
- 将QTP运行时的错误截图上传到QC
Class QCImageErrorCapture Sub Class_Terminate() 'Check if the current test has failed. If failed the ...
- selenium基础(窗口截图)
窗口截图 目的:当脚本执行出错时对当前窗口进行截图 方法:get_screenshot_as_file() #打开百度首页,搜索“selenium",完成后进行截图,并将结果保存至D:/te ...
- 深信服edr控制中心漏洞——验证码逻辑错误
验证码逻辑错误 文件:tool/log/l.php的第93行
- selenium的错误截图
在自动化测试过程中,测试执行期间需要收集获取截图信息,一方面为了错误调试代码,一方面也为了和开发沟通, 获取当前的截图 save_screenshot是获取当前截图的方法,以百度首页为例,打开百度首页 ...
随机推荐
- Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
在Tomcat的server.xml中配置两个context,出现其中一个不能正常启动,交换配置顺序,另一个又不能正常启动,即始终只有第二个配置能启动的情况.如果单独部署,都没有问题.报错大致内容如下 ...
- Context namespace element 'annotation-config' and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser] are only available on JDK 1.5 and higher
Context namespace element 'annotation-config' and its parser class [org.springframework.context.anno ...
- 【Noip模拟 20161005】公约数
问题描述 小ww最近仔细研究了公约数,他想到了以下问题:现有nn个正整数,从中选k(2≤k≤n)k(2≤k≤n) 个,设这kk个数的最大公约数为gg,则这kk个数的价值为k×gk×g.求这个价值的最大 ...
- touch修改文件时间戳
https://blog.csdn.net/lsbhjshyn/article/details/51443304 touch -t 20181011000.01 text.txt
- shell编程:基本语法
要掌握一门语言,就要先掌握它的语法.如同C语言一般,shell也有自己的语法. 变量 按照惯例,Shell变量通常由字母加下划线开头,由任意长度的字母.数字.下划线组成.有两种类型的Shell变量: ...
- CocosCreator 自定义TypeScript在VsCode的提示数据
在assets文件夹外新建xx.d.ts文件如:global.d.ts global.d.ts declare class UserData{ node:cc.Node; name:string; } ...
- Spring STS Call Hierarchy 查找不到被调用的信息
今天使用Spring的STS的时候,发现Call Hierarchy无法使用,很奇怪,发现问题出现在同一个工作区间里,如果工作区间不在此工作区间,发现还是可以找到被调用的信息的.当时在网上找也没找到 ...
- [PHP]PHPOffice/PHPExcel数据导入方法
------------------------------------------------------------------------------------ /** * PHPExcel数 ...
- 扩展C#与元编程
扩展C#与元编程 https://www.cnblogs.com/knat/p/4580393.html https://www.cnblogs.com/knat/p/4584023.html 扩展C ...
- ArcGIS案例学习笔记-查找重叠的多边形
ArcGIS案例学习笔记-查找重叠的多边形 联系方式:谢老师,135-4855-4328,xiexiaokui@qq.com 目的:对于多边形图层,查找具有重叠(相互覆盖)的面 数据: 方法: 1. ...