phpunit-selenium
phpunit-selenium copied to clipboard
Selecting multiple <option> from a <select multiple>
I have some old tests ported from SeleniumTestCase to Selenium2TestCase (btw, here's a small class i've created to make the porting easier: https://github.com/pradosoft/prado/blob/master/tests/test_tools/PradoGenericSelenium2Test.php ).
In the old tests i used addSelection() in order to select an <option> in a <select multiple> element without deselecting the currently selected items.
Such method doesn't exists in Selenium2TestCase, and googling around i saw that the current way to do this is something like:
keyPress(CONTROL);
element->click();
keyRelease(CONTROL);
If i'm not mistaken, in Selenium2TestCase no such keyPress/KeyRelease method exists, too. So, is there a way to accomplish what i'm trying to do?
This may be useful: https://github.com/giorgiosironi/phpunit-selenium/blob/master/PHPUnit/Extensions/Selenium2TestCase.php#L89
I've tried using keys() to send CONTROL and COMMAND before calling click(), but it doesn't seems to work; i suppose the key gets released before the click starts.
I have also getting same issue. I have to select multiple div elements via pressing ctrl key + click !
@giorgiosironi Is there any specific function that can press and release key !
In theory some keys are considered sticky, so they should remain pressed by default. Look for /session/:sessionId/element/:id/value and /session/:sessionId/keys at https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol