selenium 截图
http://blog.csdn.net/u010953692/article/details/78320025
# coding:utf-8
# coding:cp936
from selenium import webdriver
from PIL import Image broswer = webdriver.Chrome()
broswer.get("http://www.baidu.com")
broswer.save_screenshot(r'E:\photo.png')
baidu = broswer.find_element_by_id('su')
left = baidu.location['x']
top = baidu.location['y']
elementWidth = baidu.location['x'] + baidu.size['width']
elementHeight = baidu.location['y'] + baidu.size['height']
picture = Image.open(r'E:\photo.png')
picture = picture.crop((left, top, elementWidth, elementHeight))
picture.save(r'E:\photo2.png')
selenium 截图的更多相关文章
- Java&Selenium截图方法封装
Java&Selenium截图方法封装 package util; import org.apache.commons.io.FileUtils; import org.openqa.sele ...
- selenium截图对比校验方法
/**对比图片进行校验是否成功**/package com.allin.pc;import java.awt.image.BufferedImage;import java.awt.image.Dat ...
- selenium截图
文件结构 1.DateUtil.py # cncoding = utf-8 import time from datetime import datetime ''' 本文件主要用于获取当前的日期以及 ...
- selenium 截图加上时间戳
思路: 1 新建screenshot文件夹,不存在则创建该目录 2 在screenshot文件夹下新建当日日期文件夹,比如20190110:不存在则创建该目录 3 截图保存到当日文件夹,且截图文 ...
- selenium 截图 添加时间戳
在自动化程序中运行的代码报错信息或者是相关日志有可能并无法直观的判断出错信息.因此截图是避免不了的.为了避免因为重复运行或者是图片名称相同导致截图被覆盖. 建议在截图时使用时间戳,保证截图图片名称的唯 ...
- selenium - 截图下载图片
from selenium import webdriver from selenium.webdriver import ChromeOptions from time import sleep f ...
- selenium截图功能
selenium自动化测试完后需要查看值观的结果,或者查操作过程中是否正确,此时需要使用自带的截图功能. 示例1: from time import sleep from selenium impor ...
- 关于selenium截图
没时间深入研究源代码,凭调试解决了非浏览器级别的滚动条截图. 首先,定位到带有滚动条的元素,通过xpath. 其次,获取scrollheight和clientheight. 第三,循环截图,循环截图的 ...
- c#使用selenium截图,操作dom元素
using System; //添加selenium的引用 using OpenQA.Selenium.PhantomJS; using OpenQA.Selenium.Chrome; using O ...
随机推荐
- [洛谷P2216][HAOI2007]理想的正方形
题目大意:有一个$a\times b$的矩阵,求一个$n\times n$的矩阵,使该区域中的极差最小. 题解:二维$ST$表,每一个点试一下是不是左上角就行了 卡点:1.用了一份考试时候写的二维$S ...
- 【距离GDOI:128天】【POJ2778】DNA Sequence(AC自动机+矩阵加速)
已经128天了?怎么觉得上次倒计时150天的日子还很近啊 ....好吧为了把AC自动机搞透我也是蛮拼的..把1030和这道题对比了无数遍...最终结论是...无视时间复杂度,1030可以用这种写法解. ...
- AB序列 凹函数的性质
链接:https://www.nowcoder.com/acm/contest/113/B来源:牛客网 题目描述 给长度为n的序列A,长度为m的序列B.可以给A序列里每个元素加上x且B序列里每个元素减 ...
- WinDirStat is a disk usage statistics viewer
WinDirStat is a disk usage statistics viewer and cleanup tool for various versions of Microsoft Wind ...
- HDU2824 The Euler function
Time Limit: 1000MS Memory Limit: 32768KB 64bit IO Format: %I64d & %I64u Description The Eule ...
- js date扩展方法
/* File Created: 四月 28, 2015 */ //日期加上天数得到新的日期 //dateTemp 需要参加计算的日期,days要添加的天数,返回新的日期,日期格式:YYYY-MM-D ...
- checkbox选中 解决兼容问题
jquery 1.9 checkbox 是否选中 if($("#chk_selectedall").prop('checked')) checkbox 选中 $("#ch ...
- odp.net 读写oracle blob字段
DEVELOPER: ODP.NET Serving Winning LOBs: http://www.oracle.com/technetwork/issue-archive/2005/05-nov ...
- Visual Studio Code 好用的 source code editor
short cut https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf go to definition : F1 ...
- PSR-2 编码风格规范
本篇规范是 PSR-1 基本代码规范的继承与扩展. 本规范希望通过制定一系列规范化PHP代码的规则,以减少在浏览不同作者的代码时,因代码风格的不同而造成不便. 当多名程序员在多个项目中合作时,就需要一 ...