java+selenium3学习之一启动firefox浏览器

时间:2017-08-08 15:16:41   收藏:0   阅读:1535

package ceshi.com.lessons;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class LuanchFirefox {


public static void main(String[] args) {
System.setProperty ( "webdriver.firefox.bin" , "D:/Program Files (x86)/Mozilla Firefox/firefox.exe" );
System.setProperty("webdriver.gecko.driver", ".\\Tools\\geckodriver.exe");
WebDriver dr=new FirefoxDriver();
dr.manage().window().maximize();
dr.manage().timeouts().implicitlyWait(8, TimeUnit.SECONDS);
dr.get("http://www.baidu.com");
System.out.println("当前打开页面的标题是:" + dr.getTitle());
dr.quit();
}

}

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!