- Selenium WebDriver Quick Start Guide
- Pinakin Chaubal
- 74字
- 2021-06-24 18:26:28
Creating the first script
Type the following code. What the following script does is simply opens a new Chrome browser and navigates to the URL http://www.google.com:
public class FirstTest {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver",
"C:\\SeleniumWD\\src\\main\\resources\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com");
}
}
Right-click the file and click Run as Java Application and hurrah! A chrome browser opens and http://www.google.com gets loaded.
You have successfully created your first Selenium Script.
推薦閱讀
- pcDuino開發實戰
- Containerization with LXC
- Mobile-first Bootstrap
- Linux內核完全注釋(20周年版·第2版)
- Implementing Azure DevOps Solutions
- 突破平面3ds Max動畫設計與制作
- 注冊表應用完全DIY
- 深入淺出Node.js
- Social Data Visualization with HTML5 and JavaScript
- 寫給架構師的Linux實踐:設計并實現基于Linux的IT解決方案
- CentOS 6 Linux Server Cookbook
- 鴻蒙HarmonyOS手機應用開發實戰
- Zabbix監控系統之深度解析和實踐
- Raspberry Pi入門指南
- Linux內核分析及應用