Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selecting multiple <option> from a <select multiple> #359

Open
ctrlaltca opened this issue Dec 7, 2015 · 4 comments
Open

Selecting multiple <option> from a <select multiple> #359

ctrlaltca opened this issue Dec 7, 2015 · 4 comments

Comments

@ctrlaltca
Copy link

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?

@giorgiosironi
Copy link
Owner

@ctrlaltca
Copy link
Author

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.

@K-Deep
Copy link

K-Deep commented Apr 14, 2016

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 !

@giorgiosironi
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants