随笔分类 -  Python相关

python第三方插件包安装方法
摘要:插件包下载地址: https://pypi.org/project/requests/#files 根据插件包名拼接上面地址 下载tar.gz格式包 1、先解压 tar -zxvf XXX.tar.gz 2、进入解压包中 3、执行 python setup.py install 即可 如果使用whl 阅读全文

posted @ 2023-08-08 16:07 yanmay 阅读(146) 评论(0) 推荐(0) 编辑

python 的命令行参数使用ArgumentParser
摘要:argparse是一个python模块,用途是:命令行执行选项、参数和子命令的解释 import argparse #创建解释器parser = argparse.ArgumentParser() #添加参数parser.add_argument('-g', '--good', choices=[' 阅读全文

posted @ 2023-07-12 11:53 yanmay 阅读(118) 评论(0) 推荐(0) 编辑

python 使用selenium 不开启浏览器
摘要:selenium 不启动浏览器模式 打开浏览器再启动会浪费时间,对爬虫的性能也是个影响,还有一种就是不打开浏览器。 如下参数是针对chrome 的全局参数,不能自定义参数。 from selenium import webdriver # 还有一些其他的参数'''# 添加UAoptions.add_ 阅读全文

posted @ 2023-04-26 10:57 yanmay 阅读(2065) 评论(0) 推荐(0) 编辑

pytest结合allure-pytest插件 生成allure测试报告
摘要:注意:allure-pytest 从1.7之后已弃用,从2.0版本开始迁移至 allure-python 项目(即使用allure2),另外要运行allure命令行也需要Java的支持。 1、安装allure-pytest pip install -U allure-pytest 如果安装失败可以直 阅读全文

posted @ 2023-04-19 11:36 yanmay 阅读(491) 评论(0) 推荐(0) 编辑

python的pytest框架
摘要:pytest和unittest的区别: 1.安装需求不同。pytest为第三方单元测试库,需额外安装;unittest为标准库,无需额外安装。 2.用例编写规则不同。pytest编写规则较为简单,兼容性较好;unittest需按照固定的格式编写,较为复杂。 pytest优点: 能够支持简单的单元测试 阅读全文

posted @ 2023-04-10 18:24 yanmay 阅读(142) 评论(0) 推荐(0) 编辑

python UnitTest
摘要:UnitTest是python 自带的自动化测试框架 一、创建用例 二、添加用例到套件并执行用例 suit = unittest.TestSuite() suit.addTest(TestCase1.Test1.Test1("test_aaa")) #一次添加一条用例suit.addTest(Tes 阅读全文

posted @ 2023-04-07 15:46 yanmay 阅读(34) 评论(0) 推荐(0) 编辑

Windows系统运行selenium(附浏览器驱动下载地址)
摘要:1、系统已安装python; 2、安装pip 官网下载pip安装包:https://pypi.org/project/pip/#files 解压后 python setup.py install 来安装pip 安装成功后将pip添加到Windows系统环境变量 也可直接执行: ./pip.exe i 阅读全文

posted @ 2022-11-24 15:22 yanmay 阅读(401) 评论(0) 推荐(0) 编辑

Python的requests模块
摘要:requests模块: 是python的第三方模块,用来发送网络请求,常用于爬虫,能够完全满足基于HTTP协议的接口测试 pip install requests import requests 一、发送请求方法 模拟对百度发起http GET请求: response = requests.get( 阅读全文

posted @ 2022-09-05 15:55 yanmay 阅读(101) 评论(0) 推荐(0) 编辑

Python selenium测试用例设计
摘要:数据存到文本文件中,或者数据库中 或者配置文件中 1.将每个功能划分成一个模块方法 2.实现测试数据跟测试代码分离 将数据放到文本文件或者数据库中。 写一个TXT的配置文件来 代码中读取配置文件 也可以写在Excel文件中 3.对错误检查 比如输入错误的密码或者用户名,看看是否正常提示 4.将测试结 阅读全文

posted @ 2018-12-05 11:47 yanmay 阅读(21) 评论(0) 推荐(0) 编辑

Python使用selenium(二)
摘要:1.selenium鼠标事件 from selenium import webdriverb=webdriver.Firefox() url='http://www.baidu.com'b.get(url) ele=b.find_element_by_id('test') from selenium 阅读全文

posted @ 2018-12-04 15:49 yanmay 阅读(1077) 评论(0) 推荐(0) 编辑

Python使用selenium(一)
摘要:文档路径:https://selenium-python.readthedocs.io/installation.html 以下代码讲解的是在windows系统上的操作 1. 使用webdriver打开火狐浏览器from selenium import webdriverbrowser =webdr 阅读全文

posted @ 2018-12-04 11:03 yanmay 阅读(19277) 评论(0) 推荐(0) 编辑

selenium(Python)(Linux系统下运行程序代码)
摘要:Python相关:(Ubuntu下) chrome selenium驱动器: http://chromedriver.storage.googleapis.com/index.html selenium的部分命令更新: https://selenium-python.readthedocs.io/a 阅读全文

posted @ 2017-12-07 11:59 yanmay 阅读(654) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示