官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 克山县| 望谟县| 周口市| 宁河县| 东山县| SHOW| 青田县| 晴隆县| 乐清市| 乌拉特前旗| 清镇市| 栾川县| 开原市| 沁源县| 吴桥县| 城固县| 武宁县| 乌兰县| 通州市| 习水县| 铜梁县| 积石山| 辽阳市| 汶上县| 湘西| 河间市| 龙游县| 夏邑县| 汶川县| 武胜县| 疏勒县| 庆城县| 康马县| 百色市| 新丰县| 云霄县| 汨罗市| 海宁市| 黄大仙区| 隆子县| 茌平县|