安裝 Selenium Server
到 http://www.seleniumhq.org/download/ 下載 Selenium Server。完成後會取得一個 jar 檔 (ex: selenium-server-standalone-2.52.0.jar),執行方式就是一般執行 jar 的方式
java -jar selenium-server-standalone-2.52.0.jar
java -jar selenium-server-standalone-2.52.0.jar
curl -sS https://getcomposer.org/installer | php
php composer.phar require facebook/webdriver
use Facebook\WebDriver\Remote\DesiredCapabilities; use Facebook\WebDriver\Remote\RemoteWebDriver; require_once 'vendor/autoload.php'; // This would be the url of the host running the server-standalone.jar $host = 'http://localhost:4444/wd/hub'; // this is the default // Set URL $url = 'https://snippetinfo.net'; // Launch Firefox $driver = RemoteWebDriver::create($host, DesiredCapabilities::firefox()); $driver->get($url); echo $driver->getTitle();