0

I am trying to run my webdriver tests in Chrome. Here are the steps I'm using to launch Chrome driver:

Set the chrome binary path

System.setProperty("webdriver.chrome.driver", "paht\\chromedriver.exe");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.switches", Arrays.asList("--start-maximized"));
capabilities.setJavascriptEnabled(true);
capabilities.setCapability("AcceptUntrustedCertificates", true);
capabilities.setCapability("AssumeUntrustedCertificateIssuer", true);
capabilities.setCapability("chrome.switches", Arrays.asList("--ignore-certificate-errors"));
driver = new ChromeDriver( capabilities);

My Chrome browser is launched, but its not running any tests, like open url etc? Can some please assist me with the steps needed to launch working chromium browser

4

2 回答 2

2

你哪儿也不去。您实际上只是在打开浏览器,仅此而已。

在此处阅读入门页面:

http://code.google.com/p/selenium/wiki/GettingStarted

本质上,您正在寻找类似的东西:

driver.get("http://www.google.com");
于 2012-11-23T23:43:07.890 回答
0

您必须从此链接下载更新的 Chromedriver

    File file = new File("E://chromedriver.exe"); // set driver path 
    System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
    WebDriver driver = new InternetExplorerDriver();
    driver.get("http://google.com");

&

  public class chrome 
 {

 public static void main(String[] args) {

   System.setProperty("webdriver.ie.driver", "E://chromedriver.exe"); //path of chrome driver
   WebDriver driver = new InternetExplorerDriver();
   driver.get("http://www.google.com");

   }

  }

检查此代码,它对我有用。

于 2012-11-28T07:03:01.170 回答