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