Skip to content

Instantly share code, notes, and snippets.

@hugs
Created February 15, 2009 19:41
Show Gist options
  • Save hugs/64827 to your computer and use it in GitHub Desktop.
Save hugs/64827 to your computer and use it in GitHub Desktop.
Using a PHP interactive prompt utility with Selenium RC makes it easier to debug Selenium tests.
* Download and open Selenium RC from seleniumhq.org
* Download and install phpsh from phpsh.org
[terminal-1$ sudo ln -s /home/ubuntu/Apps/phpsh/phpsh /usr/local/bin/phpsh
* Start Selenium RC Server (in a new terminal window)
[terminal-2]$ cd /home/ubuntu/Apps/selenium-remote-control-1.0-beta-2/
[terminal-2]$ cd selenium-server-1.0-beta-2/
[terminal-2]$ java -jar selenium-server.jar
* Go to the Selenium PHP client library directory
[terminal-1]$ cd /home/ubuntu/Apps/selenium-remote-control-1.0-beta-2/
[terminal-1]$ cd selenium-php-client-driver-1.0-beta-2/
[terminal-1]$ ls
doc GoogleTest.php MockBrowserTest.php PEAR SeleniumTest.php
TestSuiteHeadless.php TestSuite.php
* Launch phpsh
[terminal-1]$ phpsh
* "Hello, Google!"
php> set_include_path(get_include_path() . PATH_SEPARATOR . './PEAR/');
php> require_once 'Testing/Selenium.php';
php>
php> $selenium = new Testing_Selenium("*firefox", "http://www.google.com");
php> $selenium->start()
php> $selenium->open('/')
php> $selenium->type("q", "hello world")
php> $selenium->click("btnG")
* Cleanup
php> $selenium->stop()
php> exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment