question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JavaScriptExecuter commands hang on Appium

See original GitHub issue

Description

I wan’t able to run a JavaScript executor command with the latest Java Client 6.00 beta5 which worked fine with Java Client 5.0.1. The java script command used taps an element on a hybrid application. On executing the command Appium hangs on Android, but the same command works fine with iOS device.

Environment

  • java client build version or git revision if you use some shapshot: 6.0.0 Beta 5
  • Appium server version or git revision if you use some shapshot: v1.8.2-beta
  • Desktop OS/version used to run Appium if necessary: Mac OS 10.13.5
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe:
  • Mobile platform/version under test: Android
  • Real device or emulator/simulator: Moto G4

Details

Here are the Appium logs for the error with Java Client 6.0.0 Beta 5:

[HTTP] --> POST /wd/hub/session/2ebfe2fc-538e-4a33-b84b-8d023a2d27bd/execute/sync
[HTTP] {"script":"const TAP= new Event('tap', {bubbles: true}); arguments[0].dispatchEvent(TAP);","args":[{"ELEMENT":"0.9278807728181824-1","element-6066-11e4-a52e-4f735466cecf":"0.9278807728181824-1"}]}
[W3C] Driver proxy active, passing request on via HTTP proxy
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/2ebfe2fc-538e-4a33-b84b-8d023a2d27bd/execute/sync] to [POST http://127.0.0.1:8000/wd/hub/session/8dc1232c77493a0c5b7323d5a03c990a/execute/sync] with body: {"script":"const TAP= new Event('tap', {bubbles: true}); arguments[0].dispatchEvent(TAP);","args":[{"ELEMENT":"0.9278807728181824-1","element-6066-11e4-a52e-4f735466cecf":"0.9278807728181824-1"}]}
[JSONWP Proxy] Got unexpected response: unknown command: session/8dc1232c77493a0c5b7323d5a03c990a/execute/sync

Appium log working command with Java client 5.0.1:

[HTTP] --> POST /wd/hub/session/57374a80-d0df-41bc-829c-aa88b75643a5/execute
[HTTP] {"script":"const TAP= new Event('tap', {bubbles: true}); arguments[0].dispatchEvent(TAP);","args":[{"ELEMENT":"0.2145516341478002-1","element-6066-11e4-a52e-4f735466cecf":"0.2145516341478002-1"}]}
[W3C] Driver proxy active, passing request on via HTTP proxy
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/57374a80-d0df-41bc-829c-aa88b75643a5/execute] to [POST http://127.0.0.1:8000/wd/hub/session/0a8fdc1898d6058a901662156269db80/execute] with body: {"script":"const TAP= new Event('tap', {bubbles: true}); arguments[0].dispatchEvent(TAP);","args":[{"ELEMENT":"0.2145516341478002-1","element-6066-11e4-a52e-4f735466cecf":"0.2145516341478002-1"}]}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"0a8fdc1898d6058a901662156269db80","status":0,"value":null}
[JSONWP Proxy] Replacing sessionId 0a8fdc1898d6058a901662156269db80 with 57374a80-d0df-41bc-829c-aa88b75643a5
[HTTP] <-- POST /wd/hub/session/57374a80-d0df-41bc-829c-aa88b75643a5/execute 200 606 ms - 76

Code To Reproduce Issue [ Good To Have ]

JavascriptExecutor js = Setup.getInstance().getWebDriver();
js.executeScript("const TAP= new Event('tap', {bubbles: true}); arguments[0].dispatchEvent(TAP);", el);

Link to Appium logs

Entire Log gist: https://gist.github.com/mayureshshirodkar/3f50762e04243fb4358f8cffd7b145d3

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mayureshshirodkarcommented, Aug 28, 2018

Thanks @mykola-mokhnach. Works well with Appium@1.9.0 with java-client commit dfb285e3b836f8b57bfec0d2e128bcae1deb4734

1reaction
mykola-mokhnachcommented, Aug 28, 2018

Yes this is fixed in appium@beta

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix 'Could not proxy command to remote server ...
How to fix 'Could not proxy command to remote server. Original error: Error: socket hang up' issue when scrolling in appium? Issues/Bugs.
Read more >
java - Getting error in Appium that mobile:longClick is not ...
CHANGES IN VERSION 1.5. Remove long-deprecated mobile: xxx. So you should: Install Android Support Repository... The Android Testing Support ...
Read more >
how to handle alert box while automating web view (appium ...
When AlertView appears on page, appium just does not accept any commands and hangs itself. Things I tried but didn't worked 1) wd.switchTo().alert().accept ......
Read more >
Most common Errors - Appium-specific : Help Center - Support
This article describes some of tthe most common Appium- specific errors you might face during Mobile native Hybrid Execution in Testsigma ...
Read more >
appium/appium - Gitter
Original error: Could not proxy command to remote server. ... I try to work with JavascriptExecutor when I run an automation test in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found