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

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.

主站蜘蛛池模板: 巴塘县| 武宣县| 合阳县| 凤山县| 临沂市| 如东县| 泸西县| 岐山县| 自贡市| 浙江省| 长春市| 镇巴县| 武汉市| 密云县| 遂平县| 和龙市| 林西县| 西华县| 台北市| 泽普县| 牡丹江市| 那曲县| 漳浦县| 汕尾市| 平塘县| 景宁| 邯郸市| 通化市| 五峰| 定西市| 沈阳市| 平阳县| 如东县| 读书| 文登市| 新安县| 铜鼓县| 盐城市| 通河县| 土默特左旗| 枝江市|