This repository was archived by the owner on Nov 29, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 195
This repository was archived by the owner on Nov 29, 2018. It is now read-only.
Mac command key should be recognized as a modifier key #3101
Copy link
Copy link
Closed
Description
Originally reported on Google Code with ID 3101
What steps will reproduce the problem?
1. Have a simple test that includes the following code (in an attempt to make a new
tab in Firefox; whether this in itself is recommended or not is irrelevant to the issue
in question, but I would like to hear feedback if there is any)
new Actions(this.driver)
.keyDown(Keys.COMMAND)
.sendKeys("t")
.keyUp(Keys.COMMAND)
.perform();
where this.driver is an instance of FirefoxDriver, Actions is org.openqa.selenium.interactions.Actions
and Keys is org.openqa.selenium.Keys.
2. Run the test
What is the expected output? What do you see instead?
I'm expecting that a new tab opens in Firefox. Instead, I get a failed tests, with
a new IllegalArgumentException("Key Down / Up events only make sense for modifier keys.")
thrown from inside org/openqa/selenium/interactions/internal/SingleKeyAction.java
The apple command key should be a valid modifier key, but the enum in the aforementioned
class only defines shift, ctrl and alt as modifier keys.
Selenium version: 2.14.0
OS: Mac OS X 10.7.2
Browser: Firefox
Brower version: 8.0.1
Here's a diff that fixes this issue:
java/client/src/org/openqa/selenium/interactions/internal/SingleKeyAction.java
Index: java/client/src/org/openqa/selenium/interactions/internal/SingleKeyAction.java
===================================================================
--- java/client/src/org/openqa/selenium/interactions/internal/SingleKeyAction.java (revision
15246)
+++ java/client/src/org/openqa/selenium/interactions/internal/SingleKeyAction.java (working
copy)
@@ -28,7 +28,7 @@
*/
public abstract class SingleKeyAction extends KeysRelatedAction {
protected final Keys key;
- private static final Keys[] MODIFIER_KEYS = {Keys.SHIFT, Keys.CONTROL, Keys.ALT};
+ private static final Keys[] MODIFIER_KEYS = {Keys.SHIFT, Keys.CONTROL, Keys.ALT,
Keys.COMMAND};
protected SingleKeyAction(Keyboard keyboard, Mouse mouse, Keys key) {
this(keyboard, mouse, null, key);
Reported by azolotkov
on 2011-12-21 13:02:45