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

Appium error: uncaughtException: Cannot read property 'executeAtom' of null #5177

Closed
rizvi opened this issue May 28, 2015 · 7 comments
Closed
Labels
Bug a problem that needs fixing

Comments

@rizvi
Copy link

rizvi commented May 28, 2015

I am doing iOS Mobile Application Testing using Selenium. I am using respectives

1. Appium version 1.3.7
2. Node JS version 2.7.5
3. ios webkit debug proxy
4. iPhone 5c
5. Xcode version 6.1

I am using a shell script which is helping me to check the ios_webkit_debug_proxy is available or not. If not exists, within 2 seconds, it will start the ios_webkit_debug_proxy.

My testing is working well. But still facing some problem in appium that Appium is stopped certainly giving an exception uncaught exception: Cannot read property 'executeAtom' of null

I have tried to solve in various ways.

1. Restart Appium and run again.
2. Update the appium version to stable latest version 1.4.0. But the error is still remaining.
3. Update the Node JS.
4. Xcode is always opened in run execution time.
5. Nullify the implicitly wait before every WebDriverWait happens. Link: http://chon.techliminal.com/ajax_wait/#/intro
6. Using java uncaught exception handler in every related class. Link: https://bharatonjava.wordpress.com/2012/09/04/uncaughtexceptionhandler-in-java/

But still error is remaining. Would you please suggest me how I can solve this problem??

For your better understanding I am attaching the log file below.

info: --> POST /wd/hub/session/38d13138-9014-4336-9464-da604dc389c7/elements {"using":"link text","value":"Logout"}
info: [debug] Waiting up to 30000ms for condition
info: [debug] [REMOTE] Executing 'find_elements' atom in default context
info: [debug] [REMOTE] Sending javascript command
info: [debug] [REMOTE] Remote debugger data sent [{"method":"Runtime.evaluate","params":{"objectGroup":"console","includeCommandLineAPI":true,"doNotPauseOnExceptionsAndMuteConsole":true,"expression":"(function(){return function(){function h(a){return...]
Debugger web socket received data :  {"result":{"result":{"type":"string","value":"{\"status\":0,\"value\":[]}"},"wasThrown":false},"id":28}
info: [debug] Waited for 40ms so far

info: [debug] [REMOTE] Executing 'find_elements' atom in default context

info: [debug] [REMOTE] Sending javascript command
info: [debug] [REMOTE] Remote debugger data sent [{"method":"Runtime.evaluate","params":{"objectGroup":"console","includeCommandLineAPI":true,"doNotPauseOnExceptionsAndMuteConsole":true,"expression":"(function(){return function(){function h(a){return...]

Debugger web socket received data :  {"result":{"result":{"type":"string","value":"{\"status\":0,\"value\":[]}"},"wasThrown":false},"id":29}
info: [debug] Waited for 581ms so far

info: [debug] [REMOTE] Executing 'find_elements' atom in default context

info: [debug] [REMOTE] Sending javascript command
info: [debug] [REMOTE] Remote debugger data sent [{"method":"Runtime.evaluate","params":{"objectGroup":"console","includeCommandLineAPI":true,"doNotPauseOnExceptionsAndMuteConsole":true,"expression":"(function(){return function(){function h(a){return...]
Debugger web socket received data :  {"result":{"result":{"type":"string","value":"{\"status\":0,\"value\":[]}"},"wasThrown":false},"id":30}
info: [debug] Waited for 1124ms so far

info: [debug] [REMOTE] Executing 'find_elements' atom in default context

info: [debug] [REMOTE] Sending javascript command
info: [debug] [REMOTE] Remote debugger data sent [{"method":"Runtime.evaluate","params":{"objectGroup":"console","includeCommandLineAPI":true,"doNotPauseOnExceptionsAndMuteConsole":true,"expression":"(function(){return function(){function h(a){return...]

Debugger web socket received data :  {"result":{"result":{"type":"string","value":"{\"status\":0,\"value\":[]}"},"wasThrown":false},"id":31}
info: [debug] Waited for 1677ms so far

info: [debug] [REMOTE] Executing 'find_elements' atom in default context

info: [debug] [REMOTE] Sending javascript command
info: [debug] [REMOTE] Remote debugger data sent [{"method":"Runtime.evaluate","params":{"objectGroup":"console","includeCommandLineAPI":true,"doNotPauseOnExceptionsAndMuteConsole":true,"expression":"(function(){return function(){function h(a){return...]
Debugger web socket received data :  {"result":{"result":{"type":"string","value":"{\"status\":0,\"value\":[]}"},"wasThrown":false},"id":32}
info: [debug] Waited for 2219ms so far

info: --> GET /wd/hub/session/38d13138-9014-4336-9464-da604dc389c7/contexts {}

info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
info: [debug] Responding to client with success: {"status":0,"value":["NATIVE_APP","WEBVIEW_13"],"sessionId":"38d13138-9014-4336-9464-da604dc389c7"}
info: <-- GET /wd/hub/session/38d13138-9014-4336-9464-da604dc389c7/contexts 200 4.231 ms - 99 {"status":0,"value":["NATIVE_APP","WEBVIEW_13"],"sessionId":"38d13138-9014-4336-9464-da604dc389c7"}
info: --> POST /wd/hub/session/38d13138-9014-4336-9464-da604dc389c7/context {"name":"NATIVE_APP"}
info: [debug] Attempting to set context to 'NATIVE_APP'
info: [debug] Responding to client with success: {"status":0,"value":"","sessionId":"38d13138-9014-4336-9464-da604dc389c7"}
info: <-- POST /wd/hub/session/38d13138-9014-4336-9464-da604dc389c7/context 200 1.432 ms - 74 {"status":0,"value":"","sessionId":"38d13138-9014-4336-9464-da604dc389c7"}
info: [debug] [REMOTE] Disconnecting from remote debugger
info: --> POST /wd/hub/session/38d13138-9014-4336-9464-da604dc389c7/context {"name":"NATIVE_APP"}
info: [debug] Attempting to set context to 'NATIVE_APP'
info: [debug] Responding to client with success: {"status":0,"value":"","sessionId":"38d13138-9014-4336-9464-da604dc389c7"}
info: <-- POST /wd/hub/session/38d13138-9014-4336-9464-da604dc389c7/context 200 1.786 ms - 74 {"status":0,"value":"","sessionId":"38d13138-9014-4336-9464-da604dc389c7"}
info: --> GET /wd/hub/session/38d13138-9014-4336-9464-da604dc389c7/window/current/size {}
info: [debug] Pushing command to appium work queue: "au.getWindowSize()"
info: [debug] Sending command to instruments: au.getWindowSize()

error: uncaughtException: Cannot read property 'executeAtom' of null date=Thu May 28 2015 17:04:10 GMT+0600 (BDT), pid=34238, uid=501, gid=20, cwd=/Applications/Appium.app/Contents/Resources/node_modules/appium, execPath=/Applications/Appium.app/Contents/Resources/node/bin/node, version=v0.12.1, argv=[/Applications/Appium.app/Contents/Resources/node/bin/node, /Applications/Appium.app/Contents/Resources/node_modules/appium/lib/server/main.js, --command-timeout, 7200, --log, /Users/ac-mac-2/Desktop/appium.log, --platform-version, 7.1, --platform-name, iOS, --app, com.bjitgroup.putter, --udid, 658e9cf7adab519460fc44aebbd0aabc28b2980e, --device-name, iPhone 5], rss=141848576, heapTotal=122566400, heapUsed=54216088, loadavg=[1.53662109375, 1.986328125, 2.01025390625], uptime=9042, trace=[column=14, file=/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/ios-controller.js,
 function=iOSController.executeAtom, line=647, method=executeAtom, native=false, column=10, file=/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/ios-controller.js,
 function=, line=311, method=null, native=false, column=13, file=/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/common.js,
 function=, line=90, method=null, native=false, column=5, file=/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/common.js,
 function=, line=66, method=null, native=false, column=15, file=timers.js, function=Timer.listOnTimeout, line=110, method=listOnTimeout, native=false],
 stack=[TypeError: Cannot read property 'executeAtom' of null,
     at iOSController.executeAtom (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/ios-controller.js:647:14),
     at null. (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/ios-controller.js:311:10),
     at null. (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/common.js:90:13),
     at null. (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/common.js:66:5),     at Timer.listOnTimeout (timers.js:110:15)]

info: [debug] [INST] 2015-05-28 11:04:10 +0000 Debug: Got new command 3 from instruments: au.getWindowSize()

info: [debug] [INST] 2015-05-28 11:04:10 +0000 Debug: evaluating au.getWindowSize()
info: [debug] [INST] 2015-05-28 11:04:10 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-05-28 11:04:10 +0000 Debug: responding with:
info: [debug] [INST] 2015-05-28 11:04:10 +0000 Debug: Running system command #4: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":{"width":320,"height":568}}...

info: [debug] Socket data received (49 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":{"width":320,"height":568}}
info: [debug] Responding to client with success: {"status":0,"value":{"width":320,"height":568},"sessionId":"38d13138-9014-4336-9464-da604dc389c7"}
info: <-- GET /wd/hub/session/38d13138-9014-4336-9464-da604dc389c7/window/current/size 200 709.945 ms - 98 {"status":0,"value":{"width":320,"height":568},"sessionId":"38d13138-9014-4336-9464-da604dc389c7"}
info: --> POST /wd/hub/session/38d13138-9014-4336-9464-da604dc389c7/touch/perform {"actions":[{"action":"press","options":{"y":284,"x":32}},{"action":"wait","options":{"ms":500}},{"action":"moveTo","options":{"y":284,"x":256}},{"action":"release","options":{}}]}
info: [debug] Pushing command to appium work queue: "au.dragApp(32,284,256,284,0.5)"
info: [debug] Sending command to instruments: au.dragApp(32,284,256,284,0.5)

info: [debug] [INST] 2015-05-28 11:04:11 +0000 Debug: Got new command 4 from instruments: au.dragApp(32,284,256,284,0.5)

info: [debug] [INST] 2015-05-28 11:04:11 +0000 Debug: evaluating au.dragApp(32,284,256,284,0.5)
info: [debug] [INST] 2015-05-28 11:04:11 +0000 Debug: target.dragFromToForDuration({x:"32", y:"284"}, {x:"256", y:"284"}, "0.5")

info: [debug] Socket data received (25 bytes)

info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":""}

info: [debug] Responding to client with success: {"status":0,"value":"","sessionId":"38d13138-9014-4336-9464-da604dc389c7"}

info: <-- POST /wd/hub/session/38d13138-9014-4336-9464-da604dc389c7/touch/perform 200 2076.377 ms - 74 {"status":0,"value":"","sessionId":"38d13138-9014-4336-9464-da604dc389c7"}
@triager triager added the Needs Triage bugs which are not yet confirmed label May 28, 2015
@rizvi
Copy link
Author

rizvi commented May 28, 2015

@jlipps Please check the issue and help me to solve the problem.

@imurchie
Copy link
Contributor

Interesting. This looks like an async error. The first call to get the elements by link text doesn't return but the server starts handling the context methods.

@imurchie
Copy link
Contributor

Can you post your test program? I am having a hard time reproducing.

@rizvi
Copy link
Author

rizvi commented May 29, 2015

Thanks for the pointer imurchie.

Actually this is a hybrid app developed in Cordova we are automating. We need to perform a lot of context switches between NATIVE & WEBVIEW. It seems whenever we send a command to Appium to find an element or else in WEBVIEW and we switch the context to NATIVE before the Appium returns the result for WEBVIEW command, the exception occurs. I didn't check the Appium source, but I think when webkit_proxy_debug returns the WEBVIEW command to Appium, the Appium cannot find the WEBVIEW context and we get the exception.

To confirm the assumption, I put a 60 seconds delay before switching the context to NATIVE and my Appium driver implicit wait time is set to 30 secs. This will ensure that a WEBVIEW command will either return with a status or timed out before switching to NATIVE context. We didn't get any exception after that.

It would be nice to have a catch block in such condition in the Appium server.

Please let us know if you have any comments or suggestions.

Sorry, we couldn't share the test code as there is an NDA with the client. Besides we actually don't know from where in code we send this async call to Appium and the crash happens very randomly.

@imurchie
Copy link
Contributor

Appium at the moment can only handle one command at a time, so you need to wait for the return of one command before sending the next, or else things will fail in this way. We are working on a redesign of the server which will queue commands, but it is not finished yet unfortunately.

@sebv sebv added Bug a problem that needs fixing and removed Needs Triage bugs which are not yet confirmed labels Jun 3, 2015
@sebv sebv added this to the Bugs milestone Jun 4, 2015
@SrinivasanTarget
Copy link
Member

@triager please close

@triager triager closed this as completed Jul 28, 2016
@lock
Copy link

lock bot commented Apr 29, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Apr 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug a problem that needs fixing
Projects
None yet
Development

No branches or pull requests

5 participants