starrychloe edited this page Mar 27, 2015 · 3 revisions

You can find more information and download ChromeDriver in After downloading the chrome driver, we can start chrome without the selenium standalone server.

  $driver = ChromeDriver::start();

How to get Chrome driver and set the download directory

If you have chromedriver.exe in the path or the same directory that Selenium is running, then you don't need to set any variables. If you have chromedriver.exe elsewhere, you can start Selenium with $ java -jar selenium-server-standalone-2.45.0.jar

$host = 'http://localhost:4444/wd/hub'; // this is the default
$capabilities = DesiredCapabilities::htmlUnitWithJS();
  // For Chrome
  $options = new ChromeOptions();
  $prefs = array('download.default_directory' => 'c:/temp');
  $options->setExperimentalOption('prefs', $prefs);
  $capabilities = DesiredCapabilities::chrome(); 
  $capabilities->setCapability(ChromeOptions::CAPABILITY, $options);
$driver = RemoteWebDriver::create($host, $capabilities, 5000);