问题
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
回答1:
You aren't going anywhere. You are literally just opening the browser and that's it.
Read the GettingStarted page here:
http://code.google.com/p/selenium/wiki/GettingStarted
Essentially, you are looking for something like:
driver.get("http://www.google.com");
回答2:
you have to download updated Chromedriver from this link
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");
}
}
Check this code, it work for me.
来源:https://stackoverflow.com/questions/13533009/launching-chrome-driver-but-not-able-to-do-any-actions