selenium :前端
是一个用于Web应用程序测试的工具。Selenium测试直接运行在浏览器中,就像真正的用户在操做同样。支持的浏览器包括IE(7, 8, 9, 10, 11),Mozilla Firefox,Safari,Google Chrome,Opera等。这个工具的主要功能包括:测试与浏览器的兼容性——测试你的应用程序看是否可以很好得工做在不一样浏览器和操做系统之上。测试系统功能——建立回归测试检验软件功能和用户需求。支持自动录制动做和自动生成 .Net、Java、Perl等不一样语言的测试脚本。web
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相关操做chrome
安装: 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")
模拟请求地址:spa
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