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

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.

主站蜘蛛池模板: 甘南县| 永胜县| 峨眉山市| 高雄县| 马尔康县| 红安县| 金华市| 杂多县| 郧西县| 大埔区| 西林县| 延寿县| 武胜县| 富阳市| 红安县| 定边县| 濮阳市| 高邑县| 专栏| 眉山市| 嘉黎县| 太谷县| 襄城县| 岳阳县| 色达县| 丘北县| 旬阳县| 大方县| 疏附县| 肃南| 沧源| 喀什市| 金昌市| 铜山县| 翼城县| 搜索| 甘德县| 宜章县| 贵溪市| 大连市| 沈阳市|