python selenium 相关操作
selenium :
是一个用于Web应用程序测试的工具。Selenium测试直接运行在浏览器中,就像真正的用户在操作一样。支持的浏览器包括IE(7, 8, 9, 10, 11),Mozilla Firefox,Safari,Google Chrome,Opera等。这个工具的主要功能包括:测试与浏览器的兼容性——测试你的应用程序看是否能够很好得工作在不同浏览器和操作系统之上。测试系统功能——创建回归测试检验软件功能和用户需求。支持自动录制动作和自动生成 .Net、Java、Perl等不同语言的测试脚本。
- Google Chrome
- Internet Explorer 7, 8, 9, 10, 11
- Firefox
- Safari
- Opera
- HtmlUnit
- phantomjs
- Android
- iOS
Browser
|
Selenium IDE
|
Selenium Remote Control
|
Selenium Core
|
Selenium 2/Webdriver API
|
---|---|---|---|---|
Firefox 10
|
Record and playback tests
|
Start browser, run tests
|
Run tests
|
Run tests
|
Firefox 9
|
Record and playback tests
|
Start browser, run tests
|
Run tests
|
Run tests
|
Firefox 8
|
Record and playback tests
|
Start browser, run tests
|
Run tests
|
Run tests
|
Firefox 7
|
Record and playback tests
|
Start browser, run tests
|
Run tests
|
Run tests
|
Firefox 6
|
Record and playback tests
|
Start browser, run tests
|
Run tests
|
Run tests
|
Firefox 5
|
Record and playback tests
|
Start browser, run tests
|
Run tests
|
Run tests
|
Firefox 4
|
Record and playback tests
|
Start browser, run tests
|
Run tests
|
Run tests
|
Firefox 3.6
|
Record and playback tests
|
Start browser, run tests
|
Run tests
|
Run tests
|
Firefox 3
|
Record and playback tests
|
Start browser, run tests
|
Run tests
|
not supported
|
IE 9
|
not supported
|
Start browser, run tests
|
Run tests
|
Run tests
|
IE 8
|
not supported
|
Start browser, run tests
|
Run tests
|
Run tests
|
IE 7
|
not supported
|
Start browser, run tests
|
Run tests
|
Run tests
|
Safari 3
|
not supported
|
Start browser, run tests
|
Run tests
|
not supported
|
Safari 2
|
not supported
|
Start browser, run tests
|
Run tests
|
not supported
|
Opera 9
|
not supported
|
Start browser, run tests
|
Run tests
|
Run tests
|
Opera 8
|
not supported
|
Start browser, run tests
|
Run tests
|
Run tests
|
Chrome
|
not supported
|
Start browser, run tests***
|
Run tests***
|
Run tests***
|
Others
|
not supported
|
Partial support possible*
|
Run tests**
|
not supported
|
selenium相关操作
安装: pip install selenium
支持的浏览器:
导入模块:
from selenium import webdriver
浏览器插件(谷歌):链接:https://pan.baidu.com/s/17xk-6GXeach_HZTWo-AUqg
提取码:vdlj
启动浏览器:
bro = webdriver.Chrome(executable_path = r"F:\chromedriver.exe")
模拟请求地址:
bro.get("https://koudashijie.com/teachers/classes")
找到输入框,拿到前端页面ID
text_input = bro.find_element_by_id('kw')
输入内容
text_input.send_keys("蒸汽创客")
模拟提交按钮
login_btn = bro.find_element_by_id("su").click()
拿到页面
bro.page_source
python selenium 相关操作的更多相关文章
- python文件相关操作
Python文件相关操作 打开文件 打开文件,采用open方法,会将文件的句柄返回,如下: f = open('test_file.txt','r',encoding='utf-8') 在上面的代码中 ...
- python 集合相关操作
集合相关操作 集合是一个无序的,不重复的数据组合,它有着两个主要作用:去重以及关系测试. 去重指的是当把一个列表变成了集合,其中重复的内容就自动的被去掉了 关系测试指的是,测试两组数据之间的交集.差集 ...
- python集合相关操作
集合相关操作 集合是一个无序的,不重复的数据组合,它有着两个主要作用:去重以及关系测试. 去重指的是当把一个列表变成了集合,其中重复的内容就自动的被去掉了 关系测试指的是,测试两组数据之间的交集.差集 ...
- python PIL相关操作
项目中需要用python生成二维码,这里记录一下相关PIL相关操作. RGBA问题: 需要将图片A粘贴到图片B上,之前没有注意透明度问题,A的背景是透明的,粘贴到B上后,A的周围是黑的.后来才发现是P ...
- Python容器相关操作
(集合与字典除外)的容器相关操作 (1)容器的拼接 >>> 'abc' + 'def' 'abcdef' (2)容器的重复 >>> (1, 2) * 3 (1, 2 ...
- python subprocess相关操作
python subprocess常用操作 1.subprocess模块的常用函数 函数 描述 subprocess.run() Python 3.5中新增的函数.执行指定的命令,等待命令执行完成后返 ...
- python selenium --browser 操作
本节知识点: 打印URL 将浏览器最大化 设置浏览器固定宽.高 操控浏览器前进.后退 打印URL 上一节讲到,可以将浏览器的title打印出来,这里再讲个简单的,把当前URL打印出来.其实也没啥大用, ...
- 初学Python——字符串相关操作
基本字符串操作 Pyhton中字符串的格式化输出在前面已经总结了,接下来介绍一些常用的字符串操作 先定义一个字符变量,以下的操作都以此为例: name=" my name is china ...
- python 字典相关操作
字典 字典的增删改查 字典的创建方式: # 创建字典类型 info = { 'name':'李白', 'age':'25', 'sex':'男' } msg = { 'user01':'Longzel ...
随机推荐
- OpenCV 中获取图像或矩阵最大、最小值的简便方法
C++: void minMaxLoc(InputArray src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc ...
- 不错的点击li标签删除的例子
<script type="text/javascript">function delElement(obj){ obj.parentNode.removeChild( ...
- Django 中 ModelForm 的使用
定义 ModelForm 定制 ModelForm Meta 在 Form 中另外定义 Field 值得一提的一些 Field 转化 AutoField BooleanField ForeignKey ...
- LeetCode.922-按奇偶排序数组 II(Sort Array By Parity II)
这是悦乐书的第354次更新,第379篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第216题(顺位题号是922).给定非负整数的数组A,A中的一半整数是奇数,而剩下的一半 ...
- Java重写祖先类方法equals示例
Java中很重要的一个知识点就是所有类都默认继承Object类,所以创建的每一个类都继承了Object的方法,所有类都可以向上转型为Object类对象,当然可以重写Object里面的常用方法,有时候重 ...
- htc 手机
是否解锁locked unlocked 然后刷入REC
- centos7成功部署OpenLDAP
目录 一.部署OpenLDAP. 1 1.安装openLDAP. 1 2.设置openldap管理员密码... 1 3.更改openldap配置... 2 4.更改监控认证配置... 2 5.设置DB ...
- linux free 命令 查看内存使用情况
查看Linux服务器下的内存使用情况,可以使用命令free -m [root@localhost ~]$ free // 以KB为单位显示内存使用情况 [root@localhost ~]$ free ...
- java实现稀疏数组压缩
package sparseArray; public class SparseArray { public static void main(String[] args) { // TODO Aut ...
- next_permutation() 全排列函数
next_permutation() 全排列函数 这个函数是STL自带的,用来求出该数组的下一个排列组合 相当之好用,懒人专用 适用于不想自己用dfs写全排列的同学(结尾附上dfs代码) 洛谷oj可去 ...