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

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.

主站蜘蛛池模板: 堆龙德庆县| 莒南县| 韶山市| 临西县| 兰州市| 同江市| 旅游| 宁海县| 罗江县| 正镶白旗| 锡林浩特市| 贺州市| 大理市| 景谷| 榆树市| 湖州市| 兴仁县| 定边县| 大厂| 宁武县| 兰坪| 德庆县| 剑河县| 横峰县| 增城市| 崇义县| 灵山县| 景德镇市| 常德市| 苍南县| 黔东| 平远县| 丰宁| 远安县| 海兴县| 邹平县| 冕宁县| 灵璧县| 萨迦县| 潜江市| 承德市|