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

LongPress #180

Closed
shumantt opened this issue May 22, 2017 · 1 comment
Closed

LongPress #180

shumantt opened this issue May 22, 2017 · 1 comment

Comments

@shumantt
Copy link

Description

In android testing I get error "[AndroidDriver] Error: unknown action longpress" while trying to call

var pressAndHold = new TouchAction(driver);
pressAndHold.LongPress(500,700).Perfom();

Solved the issue by reflection change action "longpress" to "longPress" this way

var pressAndHold = new TouchAction(driver);
 var action = pressAndHold.LongPress(500,700);
 //SUPER DIRTY HACK
 var stepsField = pressAndHold.GetType()
                            .GetField("steps", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var field = (stepsField.GetValue(pressAndHold) as IEnumerable<object>).ElementAt(0);
var dic = field.GetType()
                .GetField("parameters", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
                .GetValue(field) as IDictionary;
dic["action"] = "longPress";

So I guess you need to change "longpress" to "longPress" in the TouchAction class

Environment

  • .NET client version 3.0.0.2
  • Appium server version 1.6.4

Link to Appium logs

https://gist.github.com/shumantt/a1e1f4c8e92313d9b7b433ed3367e38b

@mykola-mokhnach
Copy link

Thanks for the report @shumantt
You're welcome to create a PR with the fix if you want it to be done quickly

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

No branches or pull requests

2 participants