Appium error: uncaughtException: Cannot read property 'executeAtom' of null - javascript
I am doing iOS Mobile Application Testing using Selenium. I am using respectives
Appium version 1.3.7
Node JS version 2.7.5
ios webkit debug proxy
iPhone 5c
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 uncaught exception: Cannot read property 'executeAtom' of null
I have tried to solve in various ways.
Restart Appium and run again.
Update the appium version to stable latest version 1.4.0. But the
error is still remaining.
Update the Node JS.
Xcode is always opened in run execution time.
Nullify the implicitly wait before every WebDriverWait happens.
Link: http://chon.techliminal.com/ajax_wait/#/intro
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: [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":57}
info: [debug] Waited for 7659ms so far
info: --> POST /wd/hub/session/d102c79f-f695-4fbb-a020-45caf2af7b05/context {"name":"NATIVE_APP"}
info: [debug] Attempting to set context to 'NATIVE_APP'
info: [debug] Responding to client with success: {"status":0,"value":"","sessionId":"d102c79f-f695-4fbb-a020-45caf2af7b05"}
info: POST /wd/hub/session/d102c79f-f695-4fbb-a020-45caf2af7b05/context {"name":"NATIVE_APP"}
info: [debug] Attempting to set context to 'NATIVE_APP'
info: [debug] Responding to client with success: {"status":0,"value":"","sessionId":"d102c79f-f695-4fbb-a020-45caf2af7b05"}
info: POST /wd/hub/session/d102c79f-f695-4fbb-a020-45caf2af7b05/context 200 0.862 ms - 74 {"status":0,"value":"","sessionId":"d102c79f-f695-4fbb-a020-45caf2af7b05"}
error: uncaughtException: Cannot read property 'executeAtom' of null date=Fri May 22 2015 11:40:38 GMT+0600 (BDT), pid=9153, 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, --platform-version, 7.1, --platform-name, iOS, --app, com.bjitgroup.putter, --udid, 0b72ccc692943f83fa2f83e78e8b3030a760fa5f, --device-name, iPhone 5], rss=218198016, heapTotal=187542272, heapUsed=76792360, loadavg=[1.51611328125, 1.689453125, 1.67431640625], uptime=71672, 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)]
please follow this link in github. I have got a solution that is happening because of async error.
https://github.com/appium/appium/issues/5177
Related
NoSuchElementError for Android Appium locators
I am using Appium 1.22.3 and webdriverIO5 for Android mobile automation The DOM for the element I am trying to click on is as below: <android.widget.Button content-desc="Sign in"> I have used different combinations of locators as below: await $('android.widget.Button'); driver.elementsByAccessibilityId('Sign in'); $('Sign in'); $('id=Sign in') findElementByAccessibilityId("Sign in"); dr.findElementByAccessibilityId("Sign in") However none of these xpaths work and I get error as below: 2022-09-04 12:35:01:866 - [HTTP] {"using":"class name","value":"android.widget.Button"} 2022-09-04 12:35:01:869 - [debug] [W3C (b124862d)] Calling AppiumDriver.findElement() with args: ["class name","android.widget.Button","b124862d-91b8-4b4a-9d50-bba5b9b912f4"] 2022-09-04 12:35:01:869 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, css selector, -android uiautomator 2022-09-04 12:35:01:869 - [debug] [BaseDriver] Waiting up to 0 ms for condition 2022-09-04 12:35:01:869 - [debug] [WD Proxy] Matched '/element' to command name 'findElement' 2022-09-04 12:35:01:869 - [debug] [WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:8200/wd/hub/session/0900bfc4-1ae4-4c76-895d-3203dca78bcc/element] with body: {"strategy":"class name","selector":"android.widget.Button","context":"","multiple":false} 2022-09-04 12:35:02:441 - [WD Proxy] Got response with status 404: {"sessionId":"0900bfc4-1ae4-4c76-895d-3203dca78bcc","value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters","stacktrace":"io.appium.uiautomator2.common.exceptions.ElementNotFoundException: An element could not be located on the page using the given search parameters\n\tat io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:70)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:59)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:266)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:260)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:68)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)\n\tat io.netty.chann... 2022-09-04 12:35:02:441 - [debug] [W3C] Matched W3C error code 'no such element' to NoSuchElementError 2022-09-04 12:35:02:454 - [debug] [W3C (b124862d)] Encountered internal error running command: NoSuchElementError: An element could not be located on the page using the given search parameters. Appreciate any help on how to identify the correct locator here
Thanks. I was able to use let el = await $('//android.widget.Button[#content-desc="Sign in"]'); successfully finally!
SignalR - Connection stopped when multiple tabs are opened - Message is incomplete
On the frontend of my application I use the #microsoft/signalr library to send off requests to my backend hubs. This works okay in a single tab, but when a second tab is open an error is outputted to the console of the first tab and the connection stops. It's almost as if the second tab is taking over for some reason, when really I believe both should be connected to the hub on different connections with different connection ids. The error I receive in the console is as follows: [2021-04-23T09:34:22.762Z] Information: WebSocket connected to wss://localhost:6001/ptwHub?id=39HKWle3NU0eTjFxcNWsiQ. Utils.js:218 [2021-04-23T09:34:32.895Z] Error: Connection disconnected with error 'Error: Message is incomplete.'. ./node_modules/#microsoft/signalr/dist/esm/Utils.js.ConsoleLogger.log # Utils.js:218 ./node_modules/#microsoft/signalr/dist/esm/HttpConnection.js.HttpConnection.stopConnection # HttpConnection.js:542 transport.onclose # HttpConnection.js:479 ./node_modules/#microsoft/signalr/dist/esm/WebSocketTransport.js.WebSocketTransport.close # WebSocketTransport.js:189 webSocket.onmessage # WebSocketTransport.js:129 ptw.ts:22 Error: Message is incomplete. at Function../node_modules/#microsoft/signalr/dist/esm/TextMessageFormat.js.TextMessageFormat.parse (TextMessageFormat.js:13) at JsonHubProtocol../node_modules/#microsoft/signalr/dist/esm/JsonHubProtocol.js.JsonHubProtocol.parseMessages (JsonHubProtocol.js:36) at HubConnection../node_modules/#microsoft/signalr/dist/esm/HubConnection.js.HubConnection.processIncomingData (HubConnection.js:507) at WebSocketTransport.HubConnection.connection.onreceive (HubConnection.js:73) at WebSocket.webSocket.onmessage (WebSocketTransport.js:126) The code to connect to the hub is as follows: let connection = new signalR.HubConnectionBuilder().withUrl("https://localhost:6001/hub").build(); connection.on('knowledgeBaseUpdated', (userId: number) => { alert(`User ${userId} has updated the knowledge base. Please refresh.`); }); connection.start().catch(err => console.log(err)); Really not sure why the second tab would just take over the connection instead of creating a new connection. There is obviously an issue here somewhere but I'm really not sure where so any help would be really appreciated. EDIT I've enabled client side debugging for signalr and get the following output. The line which starts with HttpConnection.stopConnection is the line which appears when a new connections is attempted from a different tab. [2021-04-26T09:50:00.084Z] Debug: Starting HubConnection. Utils.js:228 [2021-04-26T09:50:00.096Z] Debug: Starting connection with transfer format 'Text'. Utils.js:228 [2021-04-26T09:50:00.099Z] Debug: Sending negotiation request: https://localhost:6001/ptwHub/negotiate?negotiateVersion=1. Utils.js:228 [2021-04-26T09:50:00.365Z] Debug: Selecting transport 'WebSockets'. Utils.js:224 [2021-04-26T09:50:00.667Z] Information: WebSocket connected to wss://localhost:6001/ptwHub?id=14d1O9-cj544_-SHeZ2fgw. Utils.js:228 [2021-04-26T09:50:00.667Z] Debug: The HttpConnection connected successfully. Utils.js:228 [2021-04-26T09:50:00.668Z] Debug: Sending handshake request. Utils.js:224 [2021-04-26T09:50:00.669Z] Information: Using HubProtocol 'json'. Utils.js:228 [2021-04-26T09:50:13.079Z] Debug: Server handshake complete. Utils.js:228 [2021-04-26T09:50:13.081Z] Debug: HttpConnection.stopConnection(Error: Message is incomplete.) called while in state Connected. Utils.js:218 [2021-04-26T09:50:13.081Z] Error: Connection disconnected with error 'Error: Message is incomplete.'. ./node_modules/#microsoft/signalr/dist/esm/Utils.js.ConsoleLogger.log # Utils.js:218 ./node_modules/#microsoft/signalr/dist/esm/HttpConnection.js.HttpConnection.stopConnection # HttpConnection.js:542 transport.onclose # HttpConnection.js:479 ./node_modules/#microsoft/signalr/dist/esm/WebSocketTransport.js.WebSocketTransport.close # WebSocketTransport.js:189 webSocket.onmessage # WebSocketTransport.js:129 Utils.js:228 [2021-04-26T09:50:13.082Z] Debug: HubConnection.connectionClosed(Error: Message is incomplete.) called while in state Connecting. Utils.js:228 [2021-04-26T09:50:13.083Z] Debug: Hub handshake failed with error 'Error: Message is incomplete.' during start(). Stopping HubConnection. Utils.js:228 [2021-04-26T09:50:13.083Z] Debug: Call to HttpConnection.stop(Error: Message is incomplete.) ignored because the connection is already in the disconnected state. Utils.js:228 [2021-04-26T09:50:13.084Z] Debug: HubConnection failed to start successfully because of error 'Error: Message is incomplete.'. When the connection starts on a particular tab, I can see the connection has started and I get a single message when I look at the Network tab of Chrome Dev Tools. When I open the second tab, another message is sent to the first time which looks like an error message.. it weirdly contains a load of red dot characters? I mage attached below. Please ignore the fact it's called ptwHub as I removed the ptw part previously to make it easier for the readers to understand.
appium-uiautomator2-server-v0.1.8.apk' exited with code 1" while getting badging info
I am trying to learn Appium, using the instructions given in the documentation: http://appium.io/docs/en/about-appium/getting-started/?lang=en I have put this code into a file called AppiumTest.js const wdio = require('webdriverio'); const opts = { port: 4723, desiredCapabilities: { platformName: "Android", platformVersion: "8.0", deviceName: "Pixel_API_26", app: "C:/Users/SStaple/AppData/Local/Android/Sdk/ApiDemos-debug.apk", automationName: "UiAutomator2" } }; const client = wdio.remote(opts); client .init() .click("~App") .click("~Alert Dialogs") .back() .back() .end(); I am running it from the Node.js command prompt, using the command: node AppiumTest.js, after starting the Appium Server. It was also necessary to have an Android 8 emulator running. (Appium Server v1.7.1) I am getting an output in the Appium Server window. There are a number of errors. The first error shown is this: Error "Command 'C\:\\Users\\SStaple\\AppData\\Local\\Android\\Sdk\\build-tools\\26.0.2\\aapt.exe d badging C\:\\Users\\SStaple\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-driver\\uiautomator2\\appium-uiautomator2-server-v0.1.8.apk' exited with code 1" while getting badging info I have tried running this command on its own in the Command Prompt: C:\Users\SStaple\AppData\Local\Android\Sdk\build-tools\26.0.2\aapt.exe d badging C:\Users\SStaple\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-uiautomator2-driver\uiautomator2\appium-uiautomator2-server-v0.1.8.apk The result I get here is this: W/zipro (13656): Error opening archive C:\Users\SStaple\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-uiautomator2-driver\uiautomator2\appium-uiautomator2-server-v0.1.8.apk: Invalid file ERROR: dump failed because no AndroidManifest.xml found Any ideas? Update 28/12/2017 - I found the solution! The file in question looked suspect. It was 0Kb in size! I downloaded the apk file from https://github.com/appium/appium-uiautomator2-server/releases and used that instead. This one is 1,518 KB in size. (Apparently there is some problem with npm not putting that apk file into the right place while beta is installed.) Having fixed that, I can move on to the next problem!
Its a known issue with apk signing. You can start with trying to update dependencies: npm install appium-uiautomator2-driver npm install appium-adb If it didn't help, there is more you can try (but that was for Linux): modify ./node-v6.11.4-linux-armv7l/lib/node_modules/appium/node_modules/appium-adb/build/lib/tools/apk-signing.js so it would return a true even if it looks not signed. case 20: context$1$0.prev = 20; context$1$0.t0 = context$1$0’catch’; _loggerJs2[‘default’].debug(“App not signed with debug cert.”); return context$1$0.abrupt(‘return’, true);
Set an item from localStorage in a protractor test
describe('The feature', function() { beforeEach(function () { browser.executeScript('localStorage.setItem("key","value");'); }); it('should do this', function() { }); }); but i get this error when the test is run against selenium with chromedriver 2.10 and chrome 37 Executing: [execute script: window.localStorage.setItem("key","value");, []]) 15:31:29.747 WARN - Exception thrown org.openqa.selenium.WebDriverException: <unknown>: Failed to read the 'localStorage' property from 'Window': Storage is disabled inside 'data:' URLs. (Session info: chrome=37.0.2062.120) (Driver info: chromedriver=2.10.267518,platform=Linux 3.11.0-26-generic x86_64) (WARNING: The server did not provide any stacktrace information) Any idea where the problem cam from ?
According to one of the answers at Remove an item from localStorage in a protractor test, this happens when you try to access localStorage without hitting the browser (say, browser.get) first when you are using the Chrome driver. The solution seems to be to hit the browser first (maybe your root page) to get a page loaded in Chrome so that you can manipulate the localStorage. That at least is what I have been doing for our project. Hope this helps!
Karma/Jasmine Tests and dropbox authentication in javascript
I'm attempting to create some tests using Karma and Jasmine for a javascript application that uses the Dropbox Datastore api. Here is a simplified test using the introductory Dropbox code from https://www.dropbox.com/developers/datastore/tutorial/js I've manually authorized the application with Dropbox in the browser before running the test, but when I run the test, it says the client is not authenticated and no error occurs. Is there something extra that needs to be done for it to authenticate when running the tests? 'use strict'; describe('dropbox', function () { var client = null; beforeEach(function() { client = new Dropbox.Client({key: '46tjf8x15q98xic'}); // Try to finish OAuth authorization. client.authenticate({interactive: false}, function (error) { if (error) { alert('Authentication error: ' + error); } }); }); it('client is not null', function() { expect( client ).not.toBeNull(); }); it('authenticated is true', function() { expect( client.isAuthenticated() ).toEqual( true ); }); }); Running "karma:unit" (karma) task INFO [karma]: Karma v0.10.9 server started at http://localhost:8080/ INFO [launcher]: Starting browser Chrome INFO [Chrome 33.0.1750 (Mac OS X 10.9.2)]: Connected on socket BKoS8rqqeeL7fg3cHEQl Chrome 33.0.1750 (Mac OS X 10.9.2) dropbox authenticated is true FAILED Expected false to equal true. Error: Expected false to equal true. at null.<anonymous> (/Users/davidsmith/Sites/myapp/test/spec/dropbox.js:23:38) Chrome 33.0.1750 (Mac OS X 10.9.2): Executed 2 of 2 (1 FAILED) (0.301 secs / 0.009 secs) Warning: Task "karma:unit" failed. Use --force to continue. Aborted due to warnings.
So, to be able to run the tests, I looked at the local storage for my browser and copied my app's dropbox key/value pair. In my test script, I added that key/value pair with var value = '{"key":"46tjf8x15q98xic","token":"srMz5w4ReBsAAAAAAAAAAWfQfibrbJfeI7LVKsbMvxRfX1pdpS6SOKqvN6DcgK1B","uid":"1407454"}'; localStorage.setItem('dropbox-auth:default:cHKvNCKVzU7Jmnyaj1InU8TBCOc', value ); Another related problem (not shown above) is that openDefaultDatastore is asyncronous so in my test script I added some code to wait until openDefaultDatastore finishes before running my tests.