列出 Selenium 支持的 Web 驱动程序的名称。
以下是 Selenium 支持的 Web 驱动程序的名称:
Google Chrome Driver [ ChromeDriver() 支持 chrome ]
HTML 单元驱动程序 [ WebClient() 支持 chrome、firefox 和 IE ]
Safari 驱动程序 [ SafariDriver() 支持 Safari ]
IOS 驱动程序 [ IOSDriver() 支持 ios ]
Android 驱动程序 [ AndroidDriver() 支持 Android ]
OperaChromium 驱动程序 [ ChromeDriver() 支持 opera ]
Gecko 驱动程序 [ FirefoxDriver() 支持 firefox ]
Microsoft WebDriver [ InternetExplorerDriver() 支持 IE ]
事件触发 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) {
System.setProperty("webdriver.gecko.driver", "C:\Users\ghs6kor\Desktop\Java\geckodriver.exe");
// working with Firefox driver
WebDriver driver = new FirefoxDriver();
String url = "https://tutorialspoint.com/index.htm";
driver.get(url);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
System.out.println("Launching the url");
driver.quit();
}
}
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP