How to setup Selenium webdriver and execute automation script

  • Selenium 2.0 includes selenium web driver compatible version.
  • Download Selenium 2.0 from
  • Install Java JRE, JDK is not required until you want to create Java programs
  • Check java version- java –version on command prompt, to be sure you have java installed
  • Start selenium through command prompt: java -jar selenium-server-standalone-<version-number>.jar
  • You can also Stop Selenium through browser: http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer
  • Write code in PHP i.e. download library ( from to execute selenium scripts
  • Save the following code as “myseleniumscript.php” file.
require_once "phpwebdriver/WebDriver.php";

$webdriver = new WebDriver("localhost", "4444");
$element = $webdriver->findElementBy(LocatorStrategy::name, "q");
$element->sendKeys(array("selenium google code" ) );

  • Make sure you have php and supporting web server like Apache already installed. Download “wamp” to install PHP, Apache
  • Run the file as localhost/myfolder/myseleniumscript.php in browser, this will open up a new firefox window and you can also check the command prompt for execution log
Both comments and pings are currently closed.

Comments are closed.