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

Cannot use META or COMMAND keys as modifiers to to action #4843

Closed
lukeis opened this issue Mar 4, 2016 · 16 comments
Closed

Cannot use META or COMMAND keys as modifiers to to action #4843

lukeis opened this issue Mar 4, 2016 · 16 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 4, 2016

Originally reported on Google Code with ID 4843

Hi,
I cannot use the META or COMMAND keys as modifer keys using KeyDown/KeyUp methods in
org.openqa.selenium.interactions.Actions class.

After debugging code, i've found the problem: it is org.openqa.selenium.interactions.internal.SingleKeyAction
class !

the only supported keys are : SHIFT, CONTROL, ALT.


Steps to reproduce:

use the following code:
consider driver as ChromeDriver Object
Actions action = new Actions(driver);
action.keyDown(Keys.META).perform();
action.sendKeys("c");
action.keyUp(Keys.META).perform();

Expected result:
keyDown/keyUp should be performed for META and COMMAND Keys

What do you see instead?
IllegalArgumentException due to the use of modifier keys that is not present in the
array of supported keys. 

Selenium version:2.26.0
OS:Mac OSX 10.8
Browser: Chrome
Browser version:23.0.1271.91 m

to fix the following problem, just change the line 37 in org.openqa.selenium.interactions.internal.SingleKeyAction
class:

 private static final Keys[] MODIFIER_KEYS = {Keys.SHIFT, Keys.CONTROL, Keys.ALT};

to the following:

 private static final Keys[] MODIFIER_KEYS = {Keys.SHIFT, Keys.CONTROL, Keys.ALT, Keys.META,Keys.COMMAND};

I've added an SVN Patch to fix this problem as an attachement file.
best regards,
Anas

Reported by anas.bihi on 2012-11-29 12:31:38


- _Attachment: [patchAnasBihi29112012.txt](https://storage.googleapis.com/google-code-attachments/selenium/issue-4843/comment-0/patchAnasBihi29112012.txt)_
@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Issue 3244 has been merged into this issue.

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

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Issue 4540 has been merged into this issue.

Reported by barancev on 2012-12-12 22:53:23

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Please sign the CLA: http://goo.gl/qC50R

Reported by barancev on 2012-12-20 06:55:14

  • Labels removed: Status-Untriaged

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Any traction on this? It should be a relatively easy fix...

Reported by kevin.t.dillon on 2013-01-02 23:20:10

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

@anas.bihi: Please can you sign the CLA http://goo.gl/qC50R , we need this to apply
your patch.

Reported by barancev on 2013-01-21 07:57:54

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I attached an updated patch to my old issue #4540 that was marked as a duplicate of
this.

Hopefully this will get things moving again.

Reported by jonatan@vaadin.com on 2013-05-02 07:17:33

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Any progress on this? Should I attach my patch here or create a new duplicate issue
for it?

Reported by jonatan@vaadin.com on 2013-05-10 05:57:58

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Hi Jona,

I have a patch + some new testcases. Waiting for permission to push, but I can upload
as a patch if the Selenium folks prefer that.

Reported by kevin.t.dillon on 2013-05-10 14:16:18

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Fix has been submitted. I'm not sure when this is going-in.

Reported by kevin.t.dillon on 2013-05-21 14:17:09

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Fixed by revision 26814a1b53fc

Reported by barancev on 2014-01-22 07:53:14

  • Status changed: Fixed
  • Labels added: Lang-Java

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Only Keys.META was added, not Keys.COMMAND. As a result, my tests still cannot run on
Mac. Any reason why?

Reported by tim.romberg on 2014-03-17 09:58:31

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

So reopening :)

Reported by barancev on 2014-03-17 10:02:47

  • Status changed: Accepted

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Apparently this was a mistake during review of my patch. My patch originally had COMMAND
and LEFT_* as well but was asked to remove them as they are aliases, but now looking
closer at the Enum, they're not aliases, but just use the same char code, which makes
the equals check fail… :(

Reported by jonatan@vaadin.com on 2014-03-17 11:00:22

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I created a new patch, adding the missing modifier keys, in https://github.com/SeleniumHQ/selenium/pull/187

Reported by jonatan@vaadin.com on 2014-03-17 11:46:48

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

The patch was merged

Reported by barancev on 2014-07-07 17:55:51

  • Status changed: Fixed

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by luke.semerau on 2015-09-17 18:16:25

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 4, 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