I am using PHP Selenium Webdriver wrapper by Facebook. Can anyone please give me an example of how to click or select an option from a select drop down menu?
I have tried this:
$test = $driver->findElement( WebDriverBy::id('drop1').WebDriverBy::cssSelector("option[value='11']"));
$test->click();
but it errors out:
Message : Object of class WebDriverBy could not be converted to string
It should be
$test = $driver->findElement( WebDriverBy::id('drop1') )
->findElement( WebDriverBy::cssSelector("option[value='11']") )
->click();
If you are working on "select" tag, use WebDriverSelect
instead.
$select = new WebDriverSelect($driver->findElement(WebDriverBy::id('drop1')));
$select->selectByValue('11');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With