
- Selenium 教程
- Selenium - 首頁
- Selenium - 概述
- Selenium - 元件
- Selenium - 自動化測試
- Selenium - 環境搭建
- Selenium - 遠端控制
- Selenium IDE 教程
- Selenium - IDE 簡介
- Selenium - 特性
- Selenium - 限制
- Selenium - 安裝
- Selenium - 建立測試
- Selenium - 建立指令碼
- Selenium - 控制流
- Selenium - 儲存變數
- Selenium - 警報和彈出視窗
- Selenium - Selenese 命令
- Selenium - Actions 命令
- Selenium - Accessors 命令
- Selenium - Assertions 命令
- Selenium - Assert/Verify 方法
- Selenium - 定位策略
- Selenium - 指令碼除錯
- Selenium - 驗證點
- Selenium - 模式匹配
- Selenium - JSON 資料檔案
- Selenium - 瀏覽器執行
- Selenium - 使用者擴充套件
- Selenium - 程式碼匯出
- Selenium - 程式碼輸出
- Selenium - JavaScript 函式
- Selenium - 外掛
- Selenium WebDriver 教程
- Selenium - 簡介
- Selenium WebDriver vs RC
- Selenium - 安裝
- Selenium - 第一個測試指令碼
- Selenium - 驅動程式會話
- Selenium - 瀏覽器選項
- Selenium - Chrome 選項
- Selenium - Edge 選項
- Selenium - Firefox 選項
- Selenium - Safari 選項
- Selenium - 雙擊
- Selenium - 右擊
- Python 中的 HTML 報告
- 處理編輯框
- Selenium - 單個元素
- Selenium - 多個元素
- Selenium Web 元素
- Selenium - 檔案上傳
- Selenium - 定位器策略
- Selenium - 相對定位器
- Selenium - 查詢器
- Selenium - 查詢所有連結
- Selenium - 使用者互動
- Selenium - WebElement 命令
- Selenium - 瀏覽器互動
- Selenium - 瀏覽器命令
- Selenium - 瀏覽器導航
- Selenium - 警報和彈出視窗
- Selenium - 處理表單
- Selenium - 視窗和標籤頁
- Selenium - 處理連結
- Selenium - 輸入框
- Selenium - 單選按鈕
- Selenium - 複選框
- Selenium - 下拉框
- Selenium - 處理 iframe
- Selenium - 處理 Cookie
- Selenium - 日期時間選擇器
- Selenium - 動態 Web 表格
- Selenium - Actions 類
- Selenium - Action 類
- Selenium - 鍵盤事件
- Selenium - 鍵向上/向下
- Selenium - 複製和貼上
- Selenium - 處理特殊鍵
- Selenium - 滑鼠事件
- Selenium - 拖放
- Selenium - 筆事件
- Selenium - 滾動操作
- Selenium - 等待策略
- Selenium - 顯式/隱式等待
- Selenium - 支援特性
- Selenium - 多選
- Selenium - 等待支援
- Selenium - 選擇支援
- Selenium - 顏色支援
- Selenium - ThreadGuard
- Selenium - 錯誤和日誌記錄
- Selenium - 異常處理
- Selenium - 雜項
- Selenium - 處理 Ajax 呼叫
- Selenium - JSON 資料檔案
- Selenium - CSV 資料檔案
- Selenium - Excel 資料檔案
- Selenium - 跨瀏覽器測試
- Selenium - 多瀏覽器測試
- Selenium - 多視窗測試
- Selenium - JavaScript 執行器
- Selenium - 無頭執行
- Selenium - 捕獲螢幕截圖
- Selenium - 捕獲影片
- Selenium - 頁面物件模型
- Selenium - 頁面工廠
- Selenium - 記錄和回放
- Selenium - 框架
- Selenium - 瀏覽上下文
- Selenium - DevTools
- Selenium Grid 教程
- Selenium - 概述
- Selenium - 架構
- Selenium - 元件
- Selenium - 配置
- Selenium - 建立測試指令碼
- Selenium - 測試執行
- Selenium - 端點
- Selenium - 自定義節點
- Selenium 報告工具
- Selenium - 報告工具
- Selenium - TestNG
- Selenium - JUnit
- Selenium - Allure
- Selenium & 其他技術
- Selenium - Java 教程
- Selenium - Python 教程
- Selenium - C# 教程
- Selenium - Javascript 教程
- Selenium - Kotlin 教程
- Selenium - Ruby 教程
- Selenium - Maven & Jenkins
- Selenium - 資料庫測試
- Selenium - LogExpert 日誌記錄
- Selenium - Log4j 日誌記錄
- Selenium - Robot Framework
- Selenium - AutoIT
- Selenium - Flash 測試
- Selenium - Apache Ant
- Selenium - Github 教程
- Selenium - SoapUI
- Selenium - Cucumber
- Selenium - IntelliJ
- Selenium - XPath
- Selenium 雜項概念
- Selenium - IE 驅動程式
- Selenium - 自動化框架
- Selenium - 關鍵字驅動框架
- Selenium - 資料驅動框架
- Selenium - 混合驅動框架
- Selenium - SSL 證書錯誤
- Selenium - 替代方案
- Selenium 有用資源
- Selenium - 問答
- Selenium - 快速指南
- Selenium - 有用資源
- Selenium - 自動化實踐
- Selenium - 討論
Selenium - 元件
Selenium 元件通常被稱為 Selenium 工具套件。總共有四個工具,統稱為 Selenium 元件。讓我們討論 Selenium 的各個元件 -
Selenium IDE
Selenium RC
Selenium Webdriver
Selenium Grid
Selenium IDE
Selenium 整合開發環境是 Selenium 套件的重要組成部分。它最初開發為 Firefox 外掛,但現在在 Firefox 和 Chrome 瀏覽器中都可用。Selenium IDE 的一些特性如下所示 -
在 Selenium IDE 中可以完成功能測試的錄製、除錯、執行和編輯。
Selenium IDE 中的指令碼是用 Selenese 開發的,Selenese 是 Selenium 中的一種指令碼語言。
Selenium IDE 命令幫助我們執行諸如點選按鈕或連結、在編輯框中輸入內容、從 Web 元素中獲取文字等任務。
Selenium IDE 測試可以轉換為 Java、C#、Python、TestNG 等格式。它的預設格式為 .html。
Selenium IDE 測試可以匯出並在 Selenium Webdriver 和 Selenium RC 中使用。
Selenium IDE 不需要技術或程式設計知識。因此,它只能用於測試簡單的場景,而不能用於涵蓋任何複雜的用例。
Selenium IDE 沒有提供用於資料驅動測試的測試引數化功能。
如果 Selenium IDE 用於複雜的測試專案,則物件和其他可重用元件的維護將很困難。
Selenium 遠端控制
Selenium 遠端控制是用 Java 實現的伺服器。它可以使用 HTTP 接受瀏覽器的命令。Selenium RC 具有 Selenium RC 伺服器和 Selenium RC 客戶端。Selenium RC 已過時,已被 Selenium 棄用。
Selenium RC 的一些特性如下所示 -
Selenium RC 中的自動化測試可以用任何程式語言開發,例如 Java、Python、C# 等。
Selenium RC 可用於編寫自動化測試以測試 Web 應用程式。
Selenium RC 包含一個代理伺服器,該伺服器允許瀏覽器工作,就像被測應用程式在代理伺服器的域中可用一樣。
要啟動測試執行,我們必須建立 Selenium RC 伺服器的例項。
Selenium WebDriver
Selenium WebDriver(從 Selenium 2 版開始)是 Selenium RC 的繼任者,它直接向瀏覽器傳送命令並檢索結果,因此它比 Selenium RC 更快。它接收命令並將它們傳遞給瀏覽器。這是藉助瀏覽器驅動程式完成的,瀏覽器驅動程式將命令傳送到瀏覽器並獲取結果。
Selenium 2 版將 Selenium RC 和 Selenium Webdriver 的有用功能合併到 Selenium Webdriver 中。後來 Selenium 3 為 Selenium Webdriver 添加了更多功能。
Selenium Webdriver 的一些特性如下所示 -
自動化測試可以用多種程式語言編寫,例如 Java、C#、Python、JavaScript 等。
Selenium webdriver 支援 Chrome、Firefox、Safari、IE 等瀏覽器。
Selenium webdriver 在多個平臺上執行,例如 Windows、Mac、Linux、Android 等。
藉助 HTMLUnit Driver 可以實現無頭執行。
Selenium webdriver 不需要伺服器來啟動測試執行,它直接與瀏覽器通訊。
Selenium webdriver 是開源的,沒有任何許可費用。
Selenium Webdriver 沒有 IDE,因此建立測試指令碼非常耗時。
Selenium Webdriver 僅支援基於 Web 的應用程式。
Selenium Webdriver 不支援自動化 QR、驗證碼和條形碼場景。
Selenium Webdriver 沒有物件儲存庫/恢復場景等功能。
Selenium Webdriver 沒有預設的測試報告生成。
Selenium Webdriver 需要程式設計和技術知識來開發自動化測試。
Selenium Webdriver 需要時間才能與新瀏覽器更好地相容和穩定。
Selenium Webdriver 難以設定,因為沒有供應商支援。
Selenium Webdriver 可以擴充套件到公開 DOM 的各種技術。
Selenium Webdriver 擁有龐大的社群支援,可以在出現問題時提供幫助。
Selenium Grid
Selenium Grid 主要用於並行測試。它遵循集線器(它是中心部分,其餘部分被視為節點)和節點架構。Selenium Grid 使我們能夠在多臺機器上同時執行各種測試。Selenium Grid 主要用於測試執行,而不是設計。
Selenium Grid 的一些特性如下所示 -
存在一個集線器機器,它使用 Selenium Grid 指導多臺機器上的執行。此外,還有多臺節點機器,在那裡進行實際執行。
Selenium Grid 支援在多個瀏覽器和平臺上進行測試。
透過允許測試並行執行來減少執行時間。
目前最新的 Selenium 版本是 4。從 Selenium 4 版本開始,整個架構完全相容 W3C - 全球資訊網聯盟,這意味著 Selenium 4 遵循 W3C 提供的所有標準和指南。我們可以從以下連結獲取有關 W3C 的更多資訊:
https://tutorialspoint.tw/world-wide-web-consortium-w3c.
Selenium 3 和 Selenium 4 之間最基本的區別在於,在 Selenium 3 中,客戶端和伺服器之間的通訊是透過 JSON Wire 協議完成的,但是從 Selenium 4 開始,伺服器和客戶端之間是直接通訊的,遵循 W3C 指南。
在 Selenium 4 之前,客戶端和伺服器之間的通訊是透過 HTTP 上的 JSON Wire 協議進行的。但是,從 Selenium 4 開始,JSON Wire 協議不再存在,客戶端和伺服器之間使用 W3C 協議進行直接通訊。
此外,Selenium 4 提供了一些額外的定位器(除了常規的定位器,如 id、class、xpath 等),稱為相對定位器,藉助於方法 - above、below、near、toRightOf、toLeftOf 以及多個相對定位器的連結。Selenium 4 還提供了對 ChromeDevTools 的訪問,這有助於除錯、網路流量分析和其他有助於自動化的功能。
因此,在本教程中,我們討論了 Selenium 的各個元件。