selenium icon indicating copy to clipboard operation
selenium copied to clipboard

Actions KeyDown/KeyUp not supporting all modifier keys

Open jvleeuwe opened this issue 9 years ago • 12 comments

Meta -

OS:
Windows 7/8/10 Selenium Version:
DotNet Webdriver 3.3.0.0 Browser:
Safari Browser Version:
10

Expected Behavior -

I can use any modifier key in "Actions" methods like "KeyDown/KeyUp"

Actual Behavior -

Only Keys.Shift, Keys.Control, Keys.Alt are supported (See SingleKeyAction.cs)

Steps to reproduce -

new Actions(Driver).KeyDown(Keys.Command).Perform();

The Java WebDriver implementation has this fixed in "SingleKeyAction.java" since march 2014. See: https://github.com/SeleniumHQ/selenium/commit/9b57e72b4a75349b0c52b9010be79c2fa68bebee#diff-b99bb200e128addef65be0b35a8c8612

jvleeuwe avatar Apr 03 '17 12:04 jvleeuwe

I am facing the same issue only with firefox3.3.1 and GeckoDriver v0.15.0

I use Actions & Key events for Keyboard shortcuts like undo/redo/delete

       actions.keyDown(command).sendKeys("z").keyUp(command).perform();

It works fine in Chrome but not in firefox.

prakash-francis-3480 avatar Apr 05 '17 07:04 prakash-francis-3480

@prakashfrancis you are experiencing this bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1332279

lmtierney avatar Apr 05 '17 12:04 lmtierney

Yes @lmtierney .,

It will be fixed in firefox 55

Thanks

prakash-francis-3480 avatar Apr 05 '17 17:04 prakash-francis-3480

@prakashfrancis Right now that's the target, but it could get uplifted to 53

lmtierney avatar Apr 05 '17 18:04 lmtierney

Thats Awesome!

Thanks

prakash-francis-3480 avatar Apr 06 '17 05:04 prakash-francis-3480

Will this be fixed anytime soon? Our tests on safari finally begin to work so this is becomming a real issue now.

jvleeuwe avatar Oct 11 '17 05:10 jvleeuwe

It is about the following fragment in "SingleKeyAction.cs".

internal class SingleKeyAction : KeyboardAction
{
    private static readonly List<string> ModifierKeys = new List<string>() { Keys.Shift, Keys.Control, Keys.Alt };

The "ModifierKeys" list should be extended to also support the Apple keyboard modifier keys like "Command"

jvleeuwe avatar Oct 11 '17 07:10 jvleeuwe

Hi! Will this be fixed anytime soon? It's a very big problem for me because of I am working on tests for macOS applications so I really need work with the "Command" button. My code looks like this:

new Actions(this.driver).KeyDown(Keys.Command).SendKeys("q").KeyUp(Keys.Command).Perform();

but it throws the next exception:

System.ArgumentException : key must be a modifier key (Keys.Shift, Keys.Control, or Keys.Alt)
Parameter name: key

mykyta-bondarenko avatar Feb 14 '18 09:02 mykyta-bondarenko

This is an issue with individual vendor webdrivers, please raise an issue with the respective vendor.

lmtierney avatar Feb 14 '18 14:02 lmtierney

@lmtierney thanks. Sorry for misunderstanding, did you mean that I should create an issue in appium-mac-driver repo? I thought that it's a selenium issue because of this functionality works correctly using python.

mykyta-bondarenko avatar Feb 15 '18 08:02 mykyta-bondarenko

@mykyta-bondarenko-gl if this is an issue with bindings please raise another issue with a reproducable scenario. As this original issue is state, it is an issue with individual vendor drivers.

lmtierney avatar Feb 15 '18 13:02 lmtierney

Thanks, I've created a new one https://github.com/SeleniumHQ/selenium/issues/5500

mykyta-bondarenko avatar Feb 15 '18 15:02 mykyta-bondarenko