自动化测试
流浪的python
QQ群:796245415
展开
-
python自动化解决验证码以及滑块验证跳过,拿邮箱为例
# coding =utf-8from selenium import webdriverfrom time import sleepdef access_code(): driver=webdriver.Chrome() driver.implicitly_wait(5) driver.get("https://mail.qq.com/cgi-bin/frame...原创 2018-11-08 21:23:48 · 2534 阅读 · 0 评论 -
Python3 logging之日志回滚RotatingFileHandler
import loggingimport osimport timeimport loggingimport logging.handlerslog_dir_path=os.getcwd()+"/logs"log_dir_path = log_dir_pathif os.path.exists(log_dir_path) and os.path.isdir(log_dir_path...原创 2019-03-10 03:36:18 · 1104 阅读 · 0 评论 -
java 递归文件夹,返回文件以及文件目录绝对路径和文件名称
getPath() 方法跟创建 File 对象时传入的路径参数有关,返回构造时传入的路径getAbsolutePath() 方法返回文件的绝对路径,如果构造的时候是全路径就直接返回全路径,如果构造时是相对路径,就返回当前目录的路径 + 构造 File 对象时的路径getCanonicalPath() 方法返回绝对路径,会把 ..\ 、.\ 这样的符号解析掉分别按顺序如下:test\.....原创 2019-03-06 20:38:05 · 622 阅读 · 0 评论 -
java httpclient文件上传下载接口实现
// download file ,两个都要带路径 public static void downloadfile(String url,String localfileName,String remotefileName) { FileOutputStream output = null; InputStream in = null; CloseableHttpClient h...原创 2019-03-05 23:42:21 · 1638 阅读 · 0 评论 -
java利用 ganymed-ssh2-build.jar来上传文件到linux以及下载linux文件以及执行linux shell命令
相关ssh2 jar包地址:http://www.ganymed.ethz.ch/ssh2/ganymed-ssh2-build210.ziplogger相关slf4j jar包地址:https://www.slf4j.org/dist/slf4j-1.8.0-beta4.ziplog4j1.2.17 jar地址:http://www.apache.org/dyn/closer.cgi/...原创 2019-03-05 23:17:06 · 1537 阅读 · 2 评论 -
Linux 安装python3 .5 解决pip 安装无法成功问题ssl安全阻拦
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl ce...原创 2019-03-05 00:52:43 · 1102 阅读 · 0 评论 -
python3.72 linux安装教程
cd /usr/localmkdir python37cd python37wgetwget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xztar xvfpython/3.7.2/Python-3.7.2.tar.xzcdPython-3.7.2yum -y install zlib zlib...原创 2019-03-04 21:45:51 · 769 阅读 · 0 评论 -
python ssh执行linux shell 命令,以及文件sftp上传下载脚本实现
# coding=utf8import paramiko""" /* python -m pip install paramiko python version 3.7 author Chen,Date:2019.2.10 */"""class SSH(object): def __init__(self,host,port,user,...原创 2019-02-10 16:53:41 · 498 阅读 · 0 评论 -
pytest 初始化setup teardown作用域
用法简介: setup_method:仅作用于class用例集中的用例,置于class内,每个用例都会调用一次 setup_function:作用于独立的def用例,不可作用于class内的用例 setup_class:作用于class用例集中的用例,置于class内,只在class用例执行的开始执行setup_class,结束时执行teardown_class setup_module:...原创 2019-02-16 19:10:17 · 1589 阅读 · 0 评论 -
pytest 运行用例失败重跑并截图到测试html报告
1.环境准备/*@param:作者:流浪的python Date:2019/01/19env:python 3.7(由于3.0-3.5以下部分pytest可能有部分兼容问题安装建议2.7-2.9,3.5-最新)pip install pytest专属 pytest框架包pip install pytest-html pytest自己专属报告包pip install p...原创 2019-01-20 00:21:42 · 4006 阅读 · 0 评论 -
pytest+allure环境搭建
配置:/*@param: @env: windows64bit @version python 3.7 amdx86-64bit @author:Chenquan @Date: 2019.01.19安装jdk1.8,这个由于allure-commandline基于java,jdk环境变量配置就不说了;pip install pytestp...原创 2019-01-19 23:43:54 · 1678 阅读 · 0 评论 -
pytest自动化运用实战
环境python 3.7 由于3.0-3.5以下部分pytest可能有部分兼容问题安装建议2.7-2.9,3.5-最新pip install pytest专属 pytest框架包pip install allure-pytest 专属allure的报告包后面会用到可以不安装这里pip install pytest-html pytest自己专属报告包pip install ...原创 2019-01-19 21:46:38 · 528 阅读 · 0 评论 -
python pymysql连接数据库自动化脚本批量插入,查询,update,delete封装代码优化以及环境config.ini文件配置
config.ini# coding=utf-8[beta]ip=10.112.123.98port=3306user=adminpwd=pwd@127see_db=see_dbec_db=ec_db[alpha]ip=10.98.96.56port=3307user=adminpwd=pwd@127see_db=see_dbec_db=ec_db# cod...原创 2019-01-19 21:11:43 · 1186 阅读 · 0 评论 -
Selenium一些很少用的知识
1、id 获取id 的属性值2、starts-with 顾名思义,匹配一个属性开始位置的关键字 -- 模糊定位3、contains 匹配一个属性值中包含的字符串 -- 模糊定位4、text() 函数文本定位5、last() 函数位置定位eg<input id="su" class="bg s_btn btnhover" value="百度一下" type=...原创 2019-01-08 22:52:49 · 124 阅读 · 0 评论 -
java Selenium webdriverwait 设置元素可见的封装
webdriver有两种等待方式:显式等待和隐式等待因为现在大部分的web应用程序会使用AJAX技术。AJAX技术简单来说就是异步JavaScript和xml,是一种用户创建快速动态网页的技术,AJAX可以使网页实现异步更新,也就是可以不重新加载整个网页的情况下,对网页部分进行更新。也就是加载网页的时候,页面的元素可能并不是同时被加载,这就对页面元素的定位产生了一定的困难。有可能在定位元素...原创 2019-01-12 23:27:26 · 2111 阅读 · 1 评论 -
selenium自动化PageObject应用实例unittest+ PageObject+html测试报告
basic_info.py# coding =utf-8import timeclass PageObject(object): def __init__(self, driver): self.driver = driver def test(self): ele = self.driver.find_element_by_id(&amp;quot;me...原创 2018-11-08 00:32:24 · 538 阅读 · 0 评论 -
python unittest 测试用例的添加
# coding=utf-8from selenium import webdriverimport unittestclass Login(unittest.TestCase): @classmethod def setUpClass(cls): cls.driver = webdriver.Chrome() ...原创 2018-11-08 00:15:14 · 645 阅读 · 0 评论 -
关于python UI Selenium自动化的一个浏览器driver重复调用问题
最开始也是和大多数一样先写个方法去定义一个驱动每次都要传入一个driver对象class PageObject(object): def __init__(self, driver): self.driver = driver def test(self): ele = self.driver.find_element_by_id("menu-...原创 2019-03-22 22:52:42 · 1722 阅读 · 1 评论