- 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.
推薦閱讀
- Implementing Cisco UCS Solutions
- Cybersecurity:Attack and Defense Strategies
- 白話區塊鏈
- Installing and Configuring Windows 10:70-698 Exam Guide
- 奔跑吧 Linux內核(入門篇)
- Linux自動化運維:Shell與Ansible(微課版)
- Application Development in iOS 7
- Learning Magento 2 Administration
- 一學就會:Windows Vista應用完全自學手冊
- OpenSolaris設備驅動原理與開發
- Linux基礎使用與案例
- Troubleshooting Docker
- 完美應用Ubuntu(第2版)
- Linux集群之美
- VMware vSphere 5.1 Cookbook