一、selenium 在java中的使用
System.setProperty("webdriver.chrome.driver", local);//加载chrome 位置
ChromeOptions options = new ChromeOptions();
options.addArguments("window-size=1280,728"); //设置窗口大小
// String user_data = System.getProperty("user.dir") + "\\src\\com\\selenium\\chrome_data";
// options.addArguments("user-data-dir=" + user_data);
// options.addArguments("headless=true"); //无头
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setCapability(ChromeOptions.CAPABILITY, options);
cap.setCapability("goog:" + ChromeOptions.CAPABILITY, options);
WebDriver webDriver = new ChromeDriver(cap);
RemoteWebDriver rdriver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),cap);//远程方式,想用多线程需要这么写
rdriver.get("http://pan.baidu.com");