![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
yuer011
这个作者很懒,什么都没留下…
展开
-
selenium iframe操作switch_to_frame
多级定位:单点策略页面切换切换进入iframe页面多层网页嵌套(页面有a,b两个frame,其中b在a内,要定位b的内容则需要先定位到a,再切到b)1)switch_to_frame()方法,表示把当前定位主题切换到frame里,其参数必须是id或name2再跳回到主框架页:driver.switch_to.default_content() #跳转主框架页3最后再跳回到主框架页:driver.switch_to.default_content() #跳转主框架页多层网页嵌原创 2021-07-03 17:08:54 · 8208 阅读 · 0 评论 -
nose-html-reporting生成报告
一、 安装库python报告:pip install nose-html-reportingpip install nosehtmloutput-2二、运行脚本:nosetests test_netdetect_policy.py --with-html-output --html-out-file=result1.html会在脚本所在目录生成一个result1.html文件,如下:三、中文显示乱码问题解决:要做编码转换解决如下:修改nose_html_reporting插件的__原创 2021-07-02 16:56:12 · 372 阅读 · 0 评论 -
selenium remont control
以下内容参考https://blog.csdn.net/lilongsy/article/details/86065447做的部分补充1.首先下载需要的jar包https://www.seleniumhq.org/download/2.指定端口的方式启动下载好的jar包,不指定默认是4444端口(此处我指定的是51515端口)java -jar selenium-server-standalone-3.141.59.jar -port 515153.开浏览器端执行以下代码(即被控方):impor原创 2021-06-29 13:42:56 · 122 阅读 · 0 评论 -
selenium tbody表单获取封装函数
def click_machine_name(name='computer_1'): """点击机器---按照机器名称 :param name: 机器名列表 [必填参数] :ip:必填参数 :return: 无返回 ,错误直接异常退出 """ find_element_by_css_selector('div[class="common-table-body"]') find_element_by_tag_name_tmp('tbody')原创 2021-06-28 18:56:45 · 1291 阅读 · 0 评论 -
Selenium-ActionChainsApi接口详解
ActionChainsUI自动化测试过程中,经常遇到那种,需要鼠标悬浮后,要操作的才会元素出现的这种场景,那么我们就要模拟鼠标悬浮到某一个位置,做一系列的连贯操作,Selenium给我们提供了ActionChains模块。引入方式from selenium.webdriver.common.action_chains import ActionChains实际上ActionChains这个模块的实现的核心思想就是,当你调用ActionChains的方法时,不会立即执行,而是会将所有的操作按顺序存转载 2021-06-25 16:15:14 · 77 阅读 · 0 评论 -
selenium find_element_by_css_selector不同方法定位
from selenium import webdriverfrom time import sleepdriver=webdriver.Chrome()driver.get('https://www.baidu.com/')# 1:通过id来定位# driver.find_element_by_css_selector("#kw").send_keys("seleniumw我要自学网") #dlement后面不需要s,通过id来定位前面需要加#号+id# 2:通过class来定位dr原创 2021-06-25 16:09:30 · 686 阅读 · 0 评论 -
linux安装python3并修改系统默认版本
一、linux系统默认python2.7版本python --version #查看python默认版本二、查看当前机器安装的所有pythonls -l /usr/bin/python*三、安装新python,python官网下载对应版本python我这里安装的是3.7.3下载后解压缩,进入解压缩后路径,一次运行命令:./configuremakemake installpython 3源码安装后,python 3会被安装在/usr/local/bin/目录,运行:ls原创 2021-06-09 17:20:07 · 1243 阅读 · 5 评论 -
PyCharm新脚本右键没有run选项,只有run nosetests in XXX(新脚本文件名)
脚本写完后不能直接run该脚本,而是出现‘nosetests in ---’原因是:命名中不能出现test,包括类名和函数名原创 2021-05-27 16:54:23 · 4767 阅读 · 0 评论 -
pycharm从git拉取分支代码以及切换分支
前提:电脑只能装了python、pycharm和git,gitlab上有需要拉取的仓库。pycharm和git关联打开Pycharm, 点击File–>Settins–>Version Control–>Git 然后在 Path to Git executable中选择本地的git.exe路径。依次点击VSC -> checkout from version concrol -> git,依次填写远程分支的clone地址(https开头的那个)和本地存放地址原创 2021-05-26 19:10:55 · 15934 阅读 · 2 评论 -
mac下python3.7和python3.8环境变量配置
mac电脑自带python2.7,并且默认使用python2.7。但是现在用 python开发东西大家基本上都是使用python3,这里说一下怎么把电脑的python设置为默认python3官网下载python安装包,直接运行安装。但你在Terminal中运行python3的话,也可以运行。但mac把python3.8安装到了一个非常难找的位置:/Library/Frameworks/Python.framework/Versions/3.8/bin。终端运行:which python3,就会看到py原创 2020-08-11 20:36:51 · 3352 阅读 · 0 评论