找到關於 Selenium WebDriver 的190 篇文章

1K+ 次瀏覽
我們可以透過以下方法在 Selenium 中提交表單:- submit() - click() 使用 submit() 方法的程式碼實現。示例 import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class SubmitScripting { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); String url = ""; driver.get(url); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); // 使用 submit() 方法提交表單 driver.findElement(By.id("")).submit(); driver.close(); } } 使用 click() 方法的程式碼實現。示例 import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; ... 閱讀更多

2K+ 次瀏覽
我們可以使用以下定位器以及 click() 方法在 Selenium 中點選連結:- By link text - By partial link text 使用 link text 定位器的程式碼實現。示例 import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class LinkScripting { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); String url = "https://tutorialspoint.tw/index.htm"; driver.get(url); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.findElement(By.linkText("Coding Ground")).click(); driver.close(); } } 使用 partial link text 定位器的程式碼實現。示例 import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; ... 閱讀更多

1K+ 次瀏覽
我們可以透過以下方式在 Selenium 中在編輯框中輸入文字:- 呼叫 sendkeys() 方法 - 使用 JavascriptExecutor 類 使用 sendkeys() 方法的程式碼實現。示例 import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class TextEnter { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); String url = "https://tutorialspoint.tw/index.htm"; driver.get(url); driver.manage().timeouts().implicitlyWait(12, TimeUnit.SECONDS); driver.findElement(By.className("gsc-input")) .sendKeys("Selenium"); driver.close(); } } 使用 JavascriptExecutor 類的程式碼實現。示例 import org.openqa.selenium.By; ... 閱讀更多

69 次瀏覽
編寫 WebDriver 指令碼的最基本步驟如下:- 透過建立指向相應瀏覽器驅動程式類的 WebDriver 引用來開啟任何瀏覽器。- 使用 get() 方法啟動任何 URL。- 暫停一段時間以載入頁面。- 確認我們位於正確的網頁上。- 最後關閉會話。程式碼實現示例 import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class WebScripting { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); String url = "https://tutorialspoint.tw/index.htm"; ... 閱讀更多

3K+ 次瀏覽
Selenium IDE 預設情況下具有一種稱為 Selenese 的語言系統。它是一組用於對 Web 執行操作的命令。它主要有助於在 Selenium IDE 中開發指令碼。它可以驗證螢幕上是否存在元素、警報、Ajax 呼叫、連結等等。Selenese 中使用了三種類型的命令。它們如下:- 操作 - 這些是可以更改應用程式狀態的命令。例如,單擊複選框、提交表單、從下拉列表中選擇選項。如果未對... 閱讀更多

1K+ 次瀏覽
Selenium 支援的 WebDriver 名稱列出如下:- Google Chrome 驅動程式 [ChromeDriver() 支援 Chrome]- HTML Unit 驅動程式 [WebClient() 支援 Chrome、Firefox 和 IE]- Safari 驅動程式 [SafariDriver() 支援 Safari]- iOS 驅動程式 [IOSDriver() 支援 iOS]- Android 驅動程式 [AndroidDriver() 支援 Android]- OperaChromium 驅動程式 [ChromeDriver() 支援 Opera]- Gecko 驅動程式 [FirefoxDriver() 支援 Firefox]- Microsoft WebDriver [InternetExplorerDriver() 支援 IE]- EventFiring WebDriver [EventFiring Driver() 支援大多數瀏覽器] 使用 Firefox 驅動程式的程式碼實現示例 import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import java.util.concurrent.TimeUnit; public class BrowserDriverScript { public static void main(String[] args) ... 閱讀更多

261 次瀏覽
Selenium 作為 Selenium 1.0 版本的一部分推出。Selenium WebDriver 作為 Selenium 2.0 版本的一部分推出。Selenium RC 現已棄用且已過時。儘管一些使用者仍在使用 Selenium RC,但它不再受到支援。Selenium RC 啟用了在多個瀏覽器(例如 Chrome、Safari、IE 等)中錄製指令碼的功能。此外,它還透過 Selenium RC 伺服器與瀏覽器通訊。Selenium WebDriver 支援跨瀏覽器測試,並且不需要 Selenium Server,這提高了其執行速度。總的來說,Selenium RC 具有... 閱讀更多

292 次瀏覽
Selenium Grid 是一種旨在跨多個瀏覽器和環境分發測試的工具。透過這個概念,我們可以同時在各種裝置和平臺上觸發大量測試用例。簡而言之,它允許並行執行。因此,Selenium Grid 有助於實現併發測試執行,從而節省大量資源。那麼使用 Selenium Grid 的優勢是什麼呢?- 並行執行可節省大量資源。- 允許跨瀏覽器測試。- 透過多臺機器節點,可以分散測試執行,然後執行。在 Selenium Grid 中,中心樞紐是一個伺服器,它監視各種... 閱讀更多

9K+ 次瀏覽
下面簡化圖描述了Selenium WebDriver的架構:現在讓我們瞭解Selenium WebDriver架構。Selenium WebDriver API實現了瀏覽器和瀏覽器驅動程式之間的互動。此架構包含四個層,即Selenium客戶端庫、JSON Wire協議、瀏覽器驅動程式和瀏覽器。Selenium客戶端庫包含Java、Ruby、Python、C#等語言。測試用例觸發後,整個Selenium程式碼將轉換為JSON格式。JSON代表JavaScript物件表示法。它負責將資訊從伺服器傳輸到客戶端。JSON Wire協議主要負責……閱讀更多

瀏覽量:144
答案:Selenium是一個自動化測試框架或套件,由Jason Huggins於2004年開發。它在過去經歷了多次升級。Selenium WebDriver 2.0於2011年上市,3.0於2016年上市,目前最新版本為4.0。Selenium用於建立自動化指令碼以驗證Web應用程式的功能需求,從而減少手動測試工作量,提高質量和生產力。它還支援各種瀏覽器和平臺。Selenium不是一個獨立的工具;它更被認為是多個工具的集合,因此它……閱讀更多