Installing PHP's Testing_Selenium on Windows

Earlier I blogged about setting up Selenium, PHPUnit et al on an Ubuntu machine.

Although I prefer to do web development on an Ubuntu machine, for 'legacy' reasons I still do some stuff on a Windows machine. For lighter web interface testing, a full CI tool like Hudson is overkill. Here's how to run Pear's Selenium_Testing alone (without PHPUnit) on Windows.

I assume you have PHP and the Pear installer on your Windows machine. Grab the Pear Selenium_Testing package with :

  • pear install Testing_Selenium-0.4.3

Next download Selenium RC from here :

Start a command window and go to where you unzipped your download. Start the Selenium RC server with this :

  • C:\SeleniumRC\selenium-remote-control-1.0.3\selenium-server-1.0.3> java -jar selenium-server.jar

This assumes you have a Java 1.6 JRE on your Windows system.

When you start the Selenium RC server, you'll get feedback like this in the command window :

22:16:17.605 INFO - Java: Sun Microsystems Inc. 1.6.0_03-b05
22:16:17.605 INFO - OS: Windows XP 5.1 x86
22:16:17.605 INFO - v2.0 [a2], with Core v2.0 [a2]
22:16:17.839 INFO - RemoteWebDriver instances should connect to:
22:16:17.839 INFO - Version Jetty/5.1.x
22:16:17.839 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]

Here's a simple test you can try. Make sure you first install the Firefox screen capture tool at to capture screenshots :

    if ($selenium->getTitle() == 'Google') {
        print "Title equals Google\n";
    } else {
        print "Title is not Google\n";
    $selenium->type("q", "luhman");
    $selenium->captureEntirePageScreenshot('c:\tmp\screenCap.png', '');
    if ($selenium->isTextPresent('')) {
        print "Found \n";
    } else {
        print "Did not find\n";
} catch (Selenium_Exception $e) {
    echo $e;