Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Command is not allowed as a modifier key #3244

Closed
lukeis opened this issue Mar 3, 2016 · 6 comments
Closed

Command is not allowed as a modifier key #3244

lukeis opened this issue Mar 3, 2016 · 6 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 3244

While trying to send the modifier key Keys.COMMAND to the browser via the ActionBuilder,
I get the following exception: 

java.lang.IllegalArgumentException: Key Down / Up events only make sense for modifier
keys.
    at org.openqa.selenium.interactions.internal.SingleKeyAction.<init>(SingleKeyAction.java:46)
    at org.openqa.selenium.interactions.KeyDownAction.<init>(KeyDownAction.java:32)
    at org.openqa.selenium.interactions.Actions.keyDown(Actions.java:98)
    at org.openqa.selenium.interactions.Actions.keyDown(Actions.java:85)
    at 

This is incorrect because COMMAND is routinely used as a modifier on Mac.

Repro: 

           Action modifierkey = builder
                .keyDown(Keys.COMMAND)
                .build();
           modifierkey.perform();

Reported by kevin.t.dillon on 2012-01-20 22:25:44

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by barancev on 2012-01-26 09:28:44

  • Labels added: Component-WebDriver, OpSys-OSX

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by dawagner on 2012-04-11 11:25:06

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I had the same problem with META, which is basically the same key as COMMAND. A patch
for the META key can be found attached to http://code.google.com/p/selenium/issues/detail?id=4540
and can easily be extended to cover Keys.COMMAND.

Reported by jonatan@vaadin.com on 2012-09-12 08:16:10

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Try .sendKeys(), it will work fine. Something like:
Action modifierkey = builder
                .sendKeys("\uE03D")
                .build();
           modifierkey.perform();
in your case ;)

Reported by IevgNak on 2012-12-11 14:48:46

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by barancev on 2012-12-12 22:51:38

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:14:37

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 3, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant