select a option with selenium2+phpunit select a option with selenium2+phpunit selenium selenium

select a option with selenium2+phpunit


it's relatively simple.

$this->select($this->byId('selectMenu'))->selectOptionByValue('t3');

this should select the selectbox's option based on value. Using PHPUnit Selenium 2 v1.3.3


I found I needed to convert the PHPUnit_Extensions_Selenium2TestCase_Element to a PHPUnit_Extensions_Selenium2TestCase_Element_Select:

PHPUnit_Extensions_Selenium2TestCase_Element_Select::fromElement($this->byId('selectMenu'))->selectOptionByValue('t3');

Also see this other question


$this->byId('selectMenu')->selectOptionByValue('t3');