testing
testing

Reputation: 229

Not able to click on hardware Menu button using appium in Java

I am working on automation of mobile native app using Appium in Java language. I want to click on hardware Menu button

I am using following code

JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("mobile: keyevent", 82);

and its giving me following error message

An unknown server-side error occurred while processing the command. (WARNING: The server did not provide any stacktrace information)(..)

Please let me know if I am doing anything wrong in my code.

Upvotes: 1

Views: 1075

Answers (1)

Swapnil Kotwal
Swapnil Kotwal

Reputation: 5720

driver.execute_script("mobile: keyevent", {"keycode": 82})

OR if above doesn't work try this :-

  HashMap swipeObject = new HashMap(); swipeObject.put("keycode", 82);

 ((JavascriptExecutor ) driver).executeScript("mobile: keyevent", swipeObject); 

Upvotes: 2

Related Questions