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

[W3C] Does not support sending keys to active element for Mac #80

Open
reder9 opened this issue Dec 31, 2019 · 4 comments
Open

[W3C] Does not support sending keys to active element for Mac #80

reder9 opened this issue Dec 31, 2019 · 4 comments

Comments

@reder9
Copy link

reder9 commented Dec 31, 2019

Hi, it appears to me that sendKeys isn't working properly on Mac. I have ran the same code on Windows and its able to send the keys just fine.

When I try to send keys on Mac I get the following error:
org.openqa.selenium.UnsupportedCommandException: Could not find selector (post_actions:data:) for path '/session/CI8a86aw/actions'. Build info: version: 'unknown', revision: 'unknown', time: 'unknown' System info: host: 'OSX-1013-HighSierra-152.local', ip: 'fe80:0:0:0:4f0:6303:f931:2e0%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '11.0.2' Driver info: io.appium.java_client.AppiumDriver Capabilities {app: System Preferences, deviceName: Mac, javascriptEnabled: true, newCommandTimeout: 300, noReset: false, platform: MAC, platformName: Mac} Session ID: 8f851fc5-51f8-456c-8bb9-5958a4342a83 at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at org.openqa.selenium.remote.RemoteExecuteMethod.execute(RemoteExecuteMethod.java:35) at org.openqa.selenium.remote.RemoteKeyboard.sendKeys(RemoteKeyboard.java:38) at org.openqa.selenium.interactions.SendKeysAction.perform(SendKeysAction.java:56) at org.openqa.selenium.interactions.CompositeAction.perform(CompositeAction.java:34) at org.openqa.selenium.interactions.Actions$BuiltAction.perform(Actions.java:642) at com.test42.fixture.desktop.test_api.Application.sendKeys(Application.java:370) at com.test42.fixture.desktop.commands.SendKeys.execute(SendKeys.java:52) at com.test42.framework.Command.executeCommand(Command.java:1177) at com.test42.framework.FixtureState.executeCommand(FixtureState.java:695) at com.test42.console.runner.RunnerConnection.lambda$processExecuteCommand$0(RunnerConnection.java:274) at java.base/java.lang.Thread.run(Thread.java:834)

@KazuCocoa
Copy link
Member

The error happened when macOS could not find the element by https://developer.apple.com/documentation/objectivec/nsobject/1571960-methodsignatureforselector


errorString = [NSString stringWithFormat:@"Could not find selector (%@) for path '%@'.", NSStringFromSelector(selector), path];

@reder9
Copy link
Author

reder9 commented Mar 16, 2020

Should I need an element if I'm just sending keys to the desktop? If so that seems a bit funny to me. I'm not trying to enter text into an element, I just want to be able to send off keystrokes to help automate things. For example sending arrow keys to navigate around an app etc.

@KazuCocoa
Copy link
Member

KazuCocoa commented Mar 17, 2020

I noticed maybe you meant W3C actions' send keys.

For macOS has a command for session/:session_id/keys which is send keys to active element in MJSONWP spec

- (AppiumMacHTTPJSONResponse *)post_keys:(NSString*)path data:(NSData*)postData
{
return [self executeWebDriverCommandWithPath:path data:postData onMainThread:YES commandBlock:^(AfMSessionController *session, NSDictionary *commandParams, int *statusCode)
{
NSArray *value = [commandParams objectForKey:@"value"];
[session sendKeys:value];
return [AppiumMacHTTPJSONResponse responseWithJson:nil status:kAfMStatusCodeSuccess session:session.sessionId];
}];
}

@KazuCocoa KazuCocoa changed the title sendKeys not working properly for Mac [W3C] Does not support sending keys to active element for Mac Apr 12, 2020
@KazuCocoa
Copy link
Member

This root cause is this repository does not support /actions for send keys to the active elements command as W3C yet. Java client sends the /actions as the command instead of session/:session_id/keys. session/:session_id/keys is MJSONWP.

As a workaround in Java client, you can try forceMjsonwp as appium/java-client#969 (comment) . Then, Java client works as MJSONWP.

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

No branches or pull requests

2 participants