package com.demo;
import java.io.File;
import java.io.IOException;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class demo_360 {
ChromeDriverService service;
WebDriver driver;
@Before
public void before(){
// service = new ChromeDriverService.Builder()
// .usingDriverExecutable(new File("F:\\Eclipes\\Luna_WorkSpace\\360browser\\res\\chromedriver.exe"))
// .usingAnyFreePort().build();
// try {
// service.start();
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// driver = new RemoteWebDriver(service.getUrl(), DesiredCapabilities.chrome());
System.setProperty("webdriver.chrome.driver", "F:\\Eclipes\\Luna_WorkSpace\\360browser\\res\\chromedriver.exe");
// driver = new ChromeDriver();
// driver.get("http://www.baidu.com/");
}
@Test
public void test(){
String browser_url= "C:\\Users\\Administrator\\AppData\\Roaming\\360se6\\Application\\360se.exe";
ChromeOptions options = new ChromeOptions();
options.setBinary(browser_url);
driver=new ChromeDriver(options);
driver.get("http://www.baidu.com");
WebElement keyword=driver.findElement(By.xpath("//*[@id='kw']"));
keyword.sendKeys("abc");
}
}
http://blog.csdn.net/allan_shore_ma/article/details/63757206
http://blog.csdn.net/qgesxcll/article/details/54986387