Original error: io.appium.uiautomator2.common.exceptions.UiAutomator2Exception - java

Getting unknown server-side error while running the script.
The script would terminate while scrolling else it would work fine.
Log error:
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: io.appium.uiautomator2.common.exceptions.UiAutomator2Exception: java.lang.IllegalStateException: UiAutomation not connected!
at io.appium.uiautomator2.utils.UiExpressionParser.invokeMethod(UiExpressionParser.java:251)
at io.appium.uiautomator2.utils.UiScrollableParser.consumeMethodCall(UiScrollableParser.java:124)
at io.appium.uiautomator2.utils.UiScrollableParser.parse(UiScrollableParser.java:60)
at io.appium.uiautomator2.utils.UiAutomatorParser.consumeStatement(UiAutomatorParser.java:93)
at io.appium.uiautomator2.utils.UiAutomatorParser.parse(UiAutomatorParser.java:49)
at io.appium.uiautomator2.utils.LocationHelpers.toSelectors(LocationHelpers.java:95)
at io.appium.uiautomator2.utils.LocationHelpers.toSelector(LocationHelpers.java:88)
at io.appium.uiautomator2.handler.FindElement.findElement(FindElement.java:144)
at io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:75)
at io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:37)
at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:250)
at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:241)
at io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:44)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
* **Element info:
{Using=-android uiautomator, value=new UiScrollable(new UiSelector()).scrollIntoView(new UiSelector().text(" val "));}
Appium Log:

restarting adb before the test run with adb kill-server; adb start-server.
because sometimes the appium server having issue with adb so by restarting you can avoid this problem not every time when this error comes you can again start executing if not solved then please restart adb and then start executing script that will work..
Happy to help...
In case you have any doubts comment down below..

Related

How to move the focus to another app in appium

I'm writing test automation for an app. The app launches the phone dialer with a specific phone number when clicking a button. I want to return the phone number to my code and return it to the app.
I'm using appium 1.21 and java.
I've tried to use this code:
androidDriver.activateApp("com.android.phone");
System.out.println(androidDriver.findElement(MobileBy.id("digis")).getText());
androidDriver.activateApp("com.app.test"); //return to the app from dial
but i'm getting an error :
Encountered internal error running command: Error: Cannot activate
'com.android.phone'. Original error: Error executing adbExec. Original
error: 'Command '/Users/idoa/Library/Android/sdk/platform-tools/adb -P
5037 -s ce051605bd453d2502 shell monkey -p com.android.phone -c
android.intent.category.LAUNCHER 1' exited with code 252'; Stderr:
'args: [-p, com.android.phone, -c, android.intent.category.LAUNCHER,
1]
How can I do it?
Key presses on appium are done by
driver.press_keycode(code)
All required codes can be found here
187 - KEYCODE_APP_SWITCH
Try this, not sure whether it solves

When launching Appium on Android I get following error:

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: >Unable to create a new remote session. Please check the server log for more >details. Original error: An unknown server-side error occurred while processing >the command. Original error: Cannot start the 'com.iserve.UChatPay' >application. Visit >https://github.com/appium/appium/blob/master/docs/en/writing-running->appium/android/activity-startup.md for troubleshooting. Original error: >'com.iserve.UChatPay.chat.activity.SplashScreenChat' or >'com.iserve.UChatPay.com.iserve.UChatPay.chat.activity.SplashScreenChat' never >started. Visit https://github.com/appium/appium/blob/master/docs/en/writing->running-appium/android/activity-startup.md for troubleshooting
My Code :
Please check image for code
}
The error seem to indicate a wrong launch activity . Have you try abd shell to check the activity when it launch?
Make sure only one instance of appium server is running on your machine.
Close all the appium server before starting new session.

"UNAVAILABLE" gRPC failure from android client to python server

I've been struggling all day with the following issue with gRPC on Android when trying to make an RPC call to a python RPC server running on my machine (on the same network).
My android gRPC android client compiles and runs, however, I get the following error message on the client (and silence on the python server):
io.grpc.StatusRuntimeException: UNAVAILABLE
Caused by: java.io.IOException: PROTOCOL_ERROR invalid settings id: -509
The full stack-trace reads:
05-06 18:39:01.133 5018-5302/com.example.android.cimi I/SyncAdapter: Failed... :
io.grpc.StatusRuntimeException: UNAVAILABLE
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:227)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:208)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:141)
at com.example.android.cimi.CimiSyncerGrpc$CimiSyncerBlockingStub.getHouseholdTimestamps(CimiSyncerGrpc.java:209)
at com.example.android.cimi.SyncAdapter.onPerformSync(SyncAdapter.java:130)
at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)
Caused by: java.io.IOException: PROTOCOL_ERROR invalid settings id: -509
at io.grpc.okhttp.internal.framed.Http2.ioException(Http2.java:589)
at io.grpc.okhttp.internal.framed.Http2.access$200(Http2.java:47)
at io.grpc.okhttp.internal.framed.Http2$Reader.readSettings(Http2.java:304)
at io.grpc.okhttp.internal.framed.Http2$Reader.nextFrame(Http2.java:162)
at io.grpc.okhttp.OkHttpClientTransport$ClientFrameHandler.run(OkHttpClientTransport.java:868)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
05-06 18:39:01.139 5018-5018/com.example.android.cimi I/SyncService: Service destroyed
When shutting off the server, I get a different error, so something else must be going on.
I'm using the following versions:
io.grpc:protoc-gen-grpc-java:1.3.0
com.google.protobuf:protoc:3.0.0
Things I've tried:
Downgrading to grpc 1.0.0
Downgrading Android studio
Tried python 2&3
Connecting from a python client works!
How else could I debug this? Is there any way to get more meaningful exceptions? Is there a way to make the server more verbose?
Any help would be greatly appreciated!
I've narrowed it down to a problem with the python gRPC server by confirming that the call works when using a Java server instead.
It turns out it must have been related to recent gRPC/protobuf python packages (just installed via pip install, must have grabbed the most recent ones):
The following sequence of commands for downgrading the gRPC installation solved the issue:
cd /usr/lib/python2.7/site-packages
rm -rf packaging*
rm -rf pyparsing*
pip2 install protobuf==3.0.0
pip2 install grpcio==1.0.0
pip2 install grpcio-tools==1.0.0

Error emulate android ionic framework

I'm creating an app with ionic, but I can not emulate it in android to see their functions properly.
Here is the error when running the command to emulate
I'm using Ubuntu 4.14 Linux OS
sandim#Inspiron-5448:~/projects/soucgApp$ sudo ionic emulate android
Running command: /home/sandim/projects/soucgApp/hooks/after_prepare/010_add_platform_class.js /home/sandim/projects/soucgApp
add to body class: platform-android
Running command: /home/sandim/projects/soucgApp/platforms/android/cordova/run --emulator
ERROR: Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
Error: /home/sandim/projects/soucgApp/platforms/android/cordova/run: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
does anyone know how to fix this?

ADT Eclipse/Android always builds/runs in debug mode ..how it will be fixed

The connection to adb is down, and a severe error has occured.
[2013-09-12 12:53:12 - Demo] You must restart adb and Eclipse.
[2013-09-12 12:53:12 - Demo] Please ensure that adb is correctly located at 'C:\android-sdk-windows\android-sdk-windows\android-sdk-windows\platform-tools\adb.exe' and can be executed.
I am getting this error...
How will be the problem solved?
go and check if adb is located here or not. If yes, then just click to execute it. This should work.

Categories

Resources