PHPunit and Selenium Server 2
Some functions that are available for selenium.
Setup
// Set the browser that Selenium will launch
$this->setBrowser(String $browser);
// Set the base URL. All paths in $this->url() calls are relative to this.
$this->setBrowserUrl(String $url);
// Set the hostname of the Selenium Server
$this->setHost(String $host);
// Set the port of the Selenium Server
$this->setPort(int $port);
Selecting items
// Select the element by the given id attribute
$element = $this->byId(String $id);
// Select the element by the given name attribute
$element = $this->byName(String $name);
// Select the element by the given class name
$element = $this->byClassName(String $className);
// Select the element based on the CSS selector
// Use # for ids, . for classes or the element names like form
$element = $this->byCssSelector(String $selector);
// Select the element by the given XPath pattern
$element = $this->byXPath(String $xpath)
// Select the anchor element by the given name text
$element = $this->byLinkText(String $linkText)
Interacting with items
// Move to an element
$this->moveto($element);
// Click on the element
$element->click();
// Clear the value of the element
$element->clear();
// Return the value of the element
$element->value();
// Set the value of the element
$element->value($value);
// Return the text of the element
$element->text();
// Submit the element
$element->submit();
Selectbox
For some reason the select box works a bit different on linux and windows. To get this working on both use this to select a value:
$this->select($this->byName('locale'))->selectOptionByValue('en_US');