Source for file example.php
Documentation is available at example.php
require_once 'Selenium.php';
$selenium = new Selenium("*firefox", "http://pear.php.net/");
$result = $selenium->start ();
$selenium->open ("http://pear.php.net/packages.php");
if ($selenium->getTitle () == "PEAR :: Package Browser :: Top Level") {
$selenium->type ("q", "PEAR");
$selenium->submit ("//form");
$selenium->waitForPageToLoad ();
if ($selenium->getTitle () == "PEAR :: Search: PEAR") {
// To see this example, you need to have Simpletest library.
// You can't run simpletest with E_STRICT
require_once 'Selenium.php';
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/reporter.php';
class Example extends UnitTestCase
$this->selenium = new Selenium("*firefox", "http://pear.php.net/");
$result = $this->selenium->start();
function testPEARSearch()
$this->selenium->open("http://pear.php.net/packages.php");
$this->assertEqual("PEAR :: Package Browser :: Top Level", $this->selenium->getTitle());
$this->selenium->type("q", "PEAR");
$this->selenium->submit("//form");
$this->selenium->waitForPageToLoad(1000);
$this->assertEqual("PEAR :: Search: PEAR", $this->selenium->getTitle());
$test->run(new TextReporter());
// To see this example, you need to have PHPUnit library.
error_reporting(E_ALL|E_STRICT);
require_once 'Selenium.php';
require_once 'PHPUnit2/Framework/TestCase.php';
class Example extends PHPUnit2_Framework_TestCase
function __construct($name)
parent::__construct($name);
$this->selenium = new Selenium("*firefox", "http://pear.php.net/");
// XXX pear does not work E_STRICT because of HTTP_Request
// the options are "curl", "pear", "native"
// $this->selenium->setDriver("pear");
$result = $this->selenium->start();
function testPEARSearch()
$this->selenium->open("http://pear.php.net/packages.php");
$this->assertEquals("PEAR :: Package Browser :: Top Level", $this->selenium->getTitle());
$this->selenium->type("q", "PEAR");
$this->selenium->submit("//form");
$this->selenium->waitForPageToLoad(1000);
$this->assertEquals("PEAR :: Search: PEAR", $this->selenium->getTitle());
Documentation generated on Mon, 11 Mar 2019 14:46:49 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|