def __save_screenshot(self):
self.driver.save_screenshot('full_snap.png')
self.page_snap_obj = Image.open('full_snap.png')
return self.page_snap_obj def __request_re(self):
self.img = self.driver.find_element_by_xpath('//*[@id="verifyImg"]')
self.location = self.img.location
self.size = self.img.size
left = self.location['x']
top = self.location['y']
right = left + self.size['width']
bottom = top + self.size['height']
page = self.__save_screenshot()
image_obj = page.crop((left, top, right, bottom))
image_obj.save('code002.png')
  
  # 别人的接口图片训练识别
# url1 = 'http://47.106.210.173:19952/captcha/v3'
url = 'http://47.98.142.71:19952/captcha/v3'
image = open('code002.png', 'rb')
r = requests.post(url, image)
t = r.content.decode()
s = json.loads(t)
m = s['message']
print(m)
return m

UI自动化关于图片验证码识别的解决方法的更多相关文章

  1. UI自动化ADB出现devices offline的解决方法

    终端运行如下命令即可解决: adb kill-server adb start-server adb remount

  2. 字符型图片验证码识别完整过程及Python实现

    字符型图片验证码识别完整过程及Python实现 1   摘要 验证码是目前互联网上非常常见也是非常重要的一个事物,充当着很多系统的 防火墙 功能,但是随时OCR技术的发展,验证码暴露出来的安全问题也越 ...

  3. 字符识别Python实现 图片验证码识别

    字符型图片验证码识别完整过程及Python实现 1   摘要 验证码是目前互联网上非常常见也是非常重要的一个事物,充当着很多系统的 防火墙 功能,但是随时OCR技术的发展,验证码暴露出来的安全问题也越 ...

  4. python3图片验证码识别

    http://my.cnki.net/elibregister/CheckCode.aspx每次刷新该网页可以得到新的验证码进行测试 以我本次查看的验证码图片为例,右键保存图片为image.jpg 下 ...

  5. python3爬虫图片验证码识别

    # 图片验证码识别 环境安装# sudo apt-get install -y tesseract-ocr libtesseract-dev libleptonica-dev# pip install ...

  6. dedecms织梦系统后台验证码图片不显示的解决方法

    网站迁移后,dedecms织梦系统后台验证码图片不显示的解决方法通用解决方案-取消后台验证码功能因为没有验证码,不能进后台,所以修改php文件源代码:方法一:打开dede/login.php 找到如下 ...

  7. universal image loader在listview/gridview中滚动时重复加载图片的问题及解决方法

    在listview/gridview中使用UIL来display每个item的图片,当图片数量较多需要滑动滚动时会出现卡顿,而且加载过的图片再次上翻后依然会重复加载(显示设置好的加载中图片) 最近在使 ...

  8. IE/Chrome背景图片居中1px偏移解决方法

    最近在支持行业运营的一个推广页面,遇到了非常规的页面banner图居中的问题,为了解决此问题,做了简单的测试,做了一个小结,为经常做大促页面的兄弟姐妹们提供参考解决方案. 首先来看看现象.最经典的页面 ...

  9. Windows win7下VMware Virtual Ethernet Adapter未识别网络解决方法

    win7下VMware Virtual Ethernet Adapter未识别网络解决方法[摘] by:授客 QQ:1033553122 问题描述 win7系统下安装VMware,查看网卡适配器设置, ...

随机推荐

  1. 代码报错--------EOFError: Compressed file ended before the end-of-stream marker was reached

    背景:运行LeNet识别CIFAR-10的图像的代码时,报错: EOFError: Compressed file ended before the end-of-stream marker was ...

  2. 使用CreateMetaFile创建WMF文件,并转换为EMF文件

    #include <iostream> #include <stdio.h> #include <WINDOWS.H> #include <shellapi. ...

  3. Kendo UI for jQuery使用教程:使用MVVM初始化(二)

    [Kendo UI for jQuery最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support ...

  4. Kendo UI for jQuery使用教程:使用MVVM初始化(一)

    [Kendo UI for jQuery最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support ...

  5. js/html 判断ie浏览器版本

    1.html判断浏览器:<!--[if !IE]><!-->除ie外都可以识别<!--<![endif]--><!--[if IE]>所有ie可以 ...

  6. ToolStrip 选中某一项打勾

    (sender as ToolStripMenuItem).Checked = !(sender as ToolStripMenuItem).Checked;

  7. 关于Environment类的使用

    import org.springframework.core.env.Environment; EnvironmentAware 如何引用这个类1.可以通过 @Autowired织入Environm ...

  8. jquery input选择器 语法

    jquery input选择器 语法 作用::input 选择器选取表单元素.该选择器同样适用于 <button> 元素.大理石平台价格表 语法:$(":input") ...

  9. java 项目 文件关系 扫描 注释注入

    https://blog.csdn.net/congweijing/article/details/82499627 controller.service.serviceImpl.Mapper.Xml ...

  10. PHP大文件上传断点续传源码

    文件夹数据库处理逻辑 publicclass DbFolder { JSONObject root; public DbFolder() { this.root = new JSONObject(); ...