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

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.

主站蜘蛛池模板: 吐鲁番市| 新疆| 宜宾县| 自贡市| 南木林县| 辉南县| 荆州市| 闵行区| 饶河县| 武邑县| 泌阳县| 封开县| 隆回县| 睢宁县| 夹江县| 仪征市| 哈密市| 晴隆县| 金门县| 新晃| 古丈县| 盐山县| 永福县| 铁岭县| 辰溪县| 永新县| 拉萨市| 霸州市| 武安市| 安远县| 来凤县| 潼南县| 宁陕县| 玉田县| 栾城县| 密山市| 无锡市| 根河市| 桦甸市| 西贡区| 康乐县|