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

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.

主站蜘蛛池模板: 嵩明县| 江山市| 怀远县| 柘荣县| 曲周县| 崇文区| 溆浦县| 安西县| 讷河市| 塘沽区| 龙门县| 手游| 大田县| 德庆县| 西昌市| 滦南县| 博野县| 双城市| 鹿邑县| 永州市| 新巴尔虎右旗| 古丈县| 安岳县| 延寿县| 阜宁县| 阜阳市| 牡丹江市| 贵港市| 开封市| 牡丹江市| 安泽县| 武威市| 铜梁县| 东宁县| 兴海县| 鄂托克旗| 五大连池市| 大兴区| 遂溪县| 中阳县| 江川县|