
- Selenium 教程
- Selenium - 首頁
- Selenium - 概述
- Selenium - 元件
- Selenium - 自動化測試
- Selenium - 環境設定
- Selenium - 遠端控制
- Selenium IDE 教程
- Selenium - IDE 簡介
- Selenium - 特性
- Selenium - 限制
- Selenium - 安裝
- Selenium - 建立測試
- Selenium - 建立指令碼
- Selenium - 控制流
- Selenium - 儲存變數
- Selenium - 警報和彈出視窗
- Selenium - Selenese 命令
- Selenium - 操作命令
- Selenium - 訪問器命令
- Selenium - 斷言命令
- Selenium - 斷言/驗證方法
- Selenium - 定位策略
- Selenium - 指令碼除錯
- Selenium - 驗證點
- Selenium - 模式匹配
- Selenium - JSON 資料檔案
- Selenium - 瀏覽器執行
- Selenium - 使用者擴充套件
- Selenium - 程式碼匯出
- Selenium - 程式碼輸出
- Selenium - JavaScript 函式
- Selenium - 外掛
- Selenium WebDriver 教程
- Selenium - 簡介
- Selenium WebDriver 與 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 IDE - 操作命令
Selenium IDE 中的所有命令都稱為 Selenese 命令。藉助於Selenese 命令,我們可以在 Web 應用程式上執行所有操作。Selenese 命令分為三種類型:
基本操作命令
各種型別的操作命令如下所示:
- click(locator) - 此命令用於單擊連結、按鈕、複選框或單選按鈕。
- check(locator) - 此命令用於選中單選按鈕或複選框。
- uncheck(locator) - 此命令用於取消選中單選按鈕或複選框。
- choose cancel on next confirmation - 此命令用於處理下一個確認警報。它將取消它。
- choose cancel on next prompt - 此命令用於處理下一個警報提示。它將取消它。
- choose ok on next confirmation - 此命令用於處理下一個確認警報。它將接受它。
- click At(locator, coordinateString) - 此命令用於在特定位置單擊連結、按鈕、複選框或單選按鈕。
- close - 此命令用於關閉當前視窗。
- debugger - 此命令用於暫停測試執行以除錯測試。
- double click(locator) - 此命令用於雙擊連結、按鈕、複選框或單選按鈕。
- double click at(locator) - 此命令用於在特定位置雙擊連結、按鈕、複選框或單選按鈕。
- drag and drop to object(source locator, destination locator) - 此命令用於將元素從源定位器拖動到目標定位器。
- echo(message) - 此命令用於列印訊息。它最常用於除錯目的。
- edit content(locator, value) - 此命令用於輸入可編輯 Web 元素的值。
- execute script(script, variable name) - 此命令用於在焦點所在的視窗或框架中執行 JavaScript 命令。
- execute async script(script, variable name) - 此命令用於在焦點所在的視窗或框架中執行非同步 JavaScript 命令。
- mouse down(locator) - 此命令用於模擬使用者按下滑鼠左鍵(不釋放)。
- mouse down at(locator, coordinateString) - 此命令用於在特定位置模擬使用者按下滑鼠左鍵(不釋放)。
- mouse move at(locator, coordinateString) - 此命令用於模擬使用者在特定位置按下滑鼠按鈕。
- mouse out(locator) - 此命令用於模擬使用者將滑鼠指標移開。
- mouse over(locator) - 此命令用於模擬滑鼠懸停在由定位器標識的元素上。
- mouse up(locator) - 此命令用於模擬釋放滑鼠按鈕。
- mouse up at(locator, , coordinateString) - 此命令用於在特定位置模擬釋放滑鼠按鈕。
- open(url) - 此命令用於開啟 URL 並等待頁面載入。
- pause(wait time) - 此命令用於停止執行一段時間。
- remove selection(locator, option) - 此命令用於取消選中多選下拉列表中的選項。
- run(test case) - 此命令用於執行測試用例。
- select(locator, option) - 此命令用於在下拉列表中選擇選項。
- select frame(locator) - 此命令用於在焦點所在的視窗中選擇框架。
- select window(window handle) - 此命令用於藉助視窗控制代碼 ID 選擇彈出視窗。
- set window size(resolution) - 此命令用於指定瀏覽器的視窗大小以及瀏覽器介面。
- type(locator) - 此命令用於在輸入框中輸入文字。
示例
讓我們以以下頁面為例,我們將啟動應用程式並在姓名:旁邊的輸入框中輸入文字Selenium,使用操作命令 open、type 和 close。

要遵循的步驟如下所示:
步驟 1 - 按照連結Selenium IDE 儲存變數中描述的步驟 1 到步驟 4 進行操作。
步驟 2 - Selenium IDE 中的工作區已準備就緒。
步驟 3 - 在命令欄位中輸入 open,在目標欄位中輸入Selenium 自動化實踐表單,以啟動應用程式。
步驟 4 - 在命令欄位中輸入 type,在目標欄位中輸入 id=name,在值欄位中輸入 Selenium。請注意,id=name 是輸入框的定位器值,Selenium 是要輸入的值。
步驟 5 - 在命令欄位中輸入 close 以關閉瀏覽器視窗。

步驟 6 - 單擊左窗格中出現的三個點,然後選擇重新命名選項。
步驟 7 - 在重新命名測試用例欄位下輸入名稱,例如 Test7,然後單擊重新命名。輸入的名稱將出現在 Selenium IDE 的左側。

步驟 8 - 單擊頂部的執行所有測試,然後等待測試執行完成。在我們的示例中,我們將看到執行:1、失敗:0,以及一個綠色條表示測試成功執行且沒有任何失敗。此外,訊息 Test7 成功完成出現在日誌下方。

在上面的示例中,我們使用 id 定位器在姓氏:標籤旁邊輸入框中輸入了文字Selenium,該標籤出現在日誌下方。此外,我們在測試用例名稱 -Test7的頂部獲得了綠色的勾號,表示測試透過。所有這些都是使用 open、type 和 close 等操作命令成功執行的。
結論
本教程全面介紹了 Selenium IDE 的 Actions 命令,到此結束。我們從描述各種 Actions 命令和一個示例開始,逐步講解如何在 Selenium 中使用 Actions 命令。這將使您深入瞭解 Selenium IDE 中的 Actions 命令。建議您持續練習所學內容,並探索與 Selenium 相關的其他內容,以加深理解並拓寬視野。