找到关于 Selenium WebDriver 的190 篇文章

如何在 Selenium 中提交表单?

Debomita Bhattacharjee
更新于 2020年6月10日 12:15:38

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; ... 阅读更多

如何在 Selenium 中点击链接?

Debomita Bhattacharjee
更新于 2020年6月10日 12:12:34

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.com/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; ... 阅读更多

如何在 Selenium 中在编辑框中输入文本?

Debomita Bhattacharjee
更新于 2020年6月10日 12:09:59

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.com/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; ... 阅读更多

编写 WebDriver 脚本的最基本步骤是什么?

Debomita Bhattacharjee
更新于 2020年6月10日 12:06:16

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.com/index.htm"; ... 阅读更多

什么是 Selenese?

Debomita Bhattacharjee
更新于 2020年6月10日 12:04:50

3K+ 次浏览

Selenium IDE 默认情况下具有一种称为 Selenese 的语言系统。它是一组用于对 Web 执行操作的命令。它主要有助于在 Selenium IDE 中开发脚本。它可以验证屏幕上是否存在元素、警报、Ajax 调用、链接等等。Selenese 中使用了三种类型的命令。它们如下:- 操作 - 这些是可以更改应用程序状态的命令。例如,单击复选框、提交表单、从下拉列表中选择选项。如果未对... 阅读更多

列出 Selenium 支持的 WebDriver 的名称。

Debomita Bhattacharjee
更新于 2020年6月10日 12:03:10

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) ... 阅读更多

为什么 Selenium WebDriver 比 Selenium RC 更有优势?

Debomita Bhattacharjee
更新于 2020年6月10日 11:57:10

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 具有... 阅读更多

什么是 Selenium Grid?

Debomita Bhattacharjee
更新于 2020年6月10日 11:55:44

292 次浏览

Selenium Grid 是一种旨在跨多个浏览器和环境分发测试的工具。通过这个概念,我们可以同时在各种设备和平台上触发大量测试用例。简而言之,它允许并行执行。因此,Selenium Grid 有助于实现并发测试执行,从而节省大量资源。那么使用 Selenium Grid 的优势是什么呢?- 并行执行可节省大量资源。- 允许跨浏览器测试。- 通过多台机器节点,可以分散测试执行,然后执行。在 Selenium Grid 中,中心枢纽是一个服务器,它监视各种... 阅读更多

Selenium WebDriver 架构是什么?

Debomita Bhattacharjee
更新于 2020年6月10日 11:53:21

9K+ 次浏览

下面简化图描述了Selenium WebDriver的架构:现在让我们了解Selenium WebDriver架构。Selenium WebDriver API实现了浏览器和浏览器驱动程序之间的交互。此架构包含四个层,即Selenium客户端库、JSON Wire协议、浏览器驱动程序和浏览器。Selenium客户端库包含Java、Ruby、Python、C#等语言。测试用例触发后,整个Selenium代码将转换为JSON格式。JSON代表JavaScript对象表示法。它负责将信息从服务器传输到客户端。JSON Wire协议主要负责……阅读更多

什么是Selenium,为什么它被广泛选择?

Debomita Bhattacharjee
更新于 2020年6月10日 11:47:04

浏览量:144

答案:Selenium是一个自动化测试框架或套件,由Jason Huggins于2004年开发。它在过去经历了多次升级。Selenium WebDriver 2.0于2011年上市,3.0于2016年上市,目前最新版本为4.0。Selenium用于创建自动化脚本以验证Web应用程序的功能需求,从而减少手动测试工作量,提高质量和生产力。它还支持各种浏览器和平台。Selenium不是一个独立的工具;它更被认为是多个工具的集合,因此它……阅读更多

广告
© . All rights reserved.