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是获取当前截图的方法,以百度首页为例,打开百度首页 ...
随机推荐
- APP-11-视觉技术-通用文字识别
1.Postman测试 2.参数 https://cloud.baidu.com/doc/OCR/OCR-API.html#.EC.DF.48.27.9B.69.A4.2C.54.1B.DC.95.6 ...
- SpringBoot配置swagger2(亲测有效,如果没有配置成功,欢迎在下方留言)
一.导包: <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swa ...
- sqoop连接SqlServer2012示例
sqoop import --connect 'jdbc:sqlserver://192.168.xx.xx:1433;username=sa;password=xxxx;database=WindE ...
- 跨域(四)——document.domain
浏览器有一个合法的性质:一个页面可以设置document.domain为当前子域或比当前子域更高级的域.一般顶级就到了根域,如果设置为其他域,浏览器就会报权限错误. 利用这个性质,我们可以通过设置do ...
- Linux命令:ssh-copy-id
ssh-copy-id帮助 SSH-COPY-ID() BSD General Commands Manual SSH-COPY-ID() NAME ssh-copy-id — use locally ...
- VMware Harbor学习
同时安装Clair和Notary# ./install.sh --with-notary --with-clair 与notary或者Clair一起安装时管理Harbor的生命周期当Harbour与N ...
- TypeScript set get
private _id:number; public get id():number{ return this._id; } public set id(value:number){ this._id ...
- node 开始深入
一起学nodejs 讲师: matthew vscode+nodejs4.6 http://list.youku.com/albumlist/show/id_27966955.html?spm=a2h ...
- 第六次Scrum冲刺
第六次Scrum冲刺 1.成员今日完成情况 队员 今日完成任务 刘佳 前端构建 李佳 后端设计 周世元 数据设计 杨小妮 博客编写 许燕婷 管理团队当日及次日任务 陈水莲 性能测试用例设计 曾丽丽 性 ...
- hexo发表博文
3.4创建博客文章与发布 在hexo 目录下终端命令: $ hexo new '文件名' //会在source/_posts创建一个文件名.md文件 这就可以使用markdown编辑器开始写自己的博客 ...