I have a problem that I think is related with Android permissions, however I need some of your expertise to confirm it.
I have testing the old Samgung J5(Not rooted) with Android 8.1.0, Appium 1.10.0 with UiAutomator2 and ADB 10.0.40 (In administration mode) on some Call Handling scenarios where I need to check if determined display elements (identity, call duration, hold activated, on transfer information, etc) are displayed to user. I have seen multiple solutions to do this task, inclusively using adb to do it, but lets focus only on this problem, using only the display elements (GUI).
Scenario, user receives call.
The com.android.incallui.service.SecCallPopupService comes into action:
User receives call
When I try to inspect the com.android.incallui.service.SecCallPopupService window the Appium cannot found it:
Appium Inpector
Neither on UiAutomatorViewer:
UitAutomatorViewer
On Comment link (xml dump) you can seen the display elements that Appium, and UiAutomatorViewer can "see". Same result was obtained by using the command adb shell uiautomator dump /data/local/tmp/uidump.xml
After that, I installed the Appium Studio and try out the Appium official "Inspector" and the result was:
Appium Studio Object Spy with full access to all display elements. Very intriguim... after some research I found the following package com.experitest.uiautomator.test (running in background) was immediatelly installed on the device when I clicked on Object Spy feature and I think that is responsible to retrieve all the interface elements.
On comment link (logcat) Some logcat logs after doind object spy on Appium Studio:
Analysing the logcat we can see that Appium studios was requesting
{"response":"true","params":[],"command":"richDump"} and the package uses
some kind of node:android.view.accessibility.AccessibilityNode. Maybe using something like the Acessibility Tree node to get the elements ? I don't know...
I have read some similar questions on Stackoverflow but some solutions involves to root the device or using de ADB (its not an option),
Tryng to su root the device and chmod 777 /data/local/tmp, but if it's really necessary, how then Appium Studio can read all display elements?
Do you know any other solution that allows me to get all interface elements without root the device? How can I call the "richDump"?
Thank You for you help.
Related
I do some automated tasks an android over adb commands, at one part i need to access a webview inside the app and control it. Until now i did these things:
I get the running webview processes with this command adb shell cat /proc/net/unix
For each process i do a protforwarding with this command adb forward tcp:9222 localabstract:webview_devtools_remote_25866
I do a get request to http://localhost:9222/json and get an array with webvies accessible over this proccess (so i clould check the title and the attaced state to find the right one)
My problem is now that since a few days I always get an empty array. I still able to see the webvies at chrome://inspect/#devices and can connect.
Does anyone have an idea why i only get an empty array or know an alternative solution?
In the meantime I have found the problem. The app I control no longer uses a webview but a browser popup, so it can't be found via the search with webview.
I want to automate the Robotium tests running on my Android application, however, I need to pass in parameters to my tests in order to allow them to run with that configuration.
I can start my tests from the command line as such:
adb shell am instrument -r -w -e PARAM PARAM_1,PARAM_2 com.company.product.application.test/android.support.test.runner.AndroidJUnitRunner
I grab these parameters as such in my code:
Bundle extras = InstrumentationRegistry.getArguments();
if (extras.containsKey("PARAM")) {
this.param1= new ArrayList<>();
this.param1= Arrays.asList(extras.getString("PARAM").split("\\s*,\\s*"));
}
I am intending to call the Device Farm API (https://docs.aws.amazon.com/devicefarm/latest/APIReference/Welcome.html) to run the tests, but I am struggling to find anywhere where I can declare my arguments/parameters. Or find a way of uploading them in a file somewhere in AWS for the Device farm to read from.
I have found some articles from 4-5 years ago claiming that passing launcher parameters was not supported but it was being looked into, in case some claim me lazy, but no one has responded to any questions there, or on the Amazon forums so I thought I would place the question here.
Can anyone help me with the above?
The tests are executed by Device Farm internally so there's no way to control the arguments that get sent to it when running, currently. However, it should be possible to include additional files which could hold that same info for the tests. Here are two ideas I have regarding this:
The tests could use the extra data feature of Device Farm. The extra data zip file gets uploaded to the /sdcard on the device. Then the tests could get the information from the device itself. This is part of the schedule run API so the script running the tests can do this programmatically.
There could be a file that's included in the test apk that's uploaded to Device Farm. I've done something similar with Java Appium tests but not with instumention. In theory it should work.
Other than that, I have not found other ways of including arguments or files for Device Farm.
Hth
-James
I've loaded Android onto VirtualBox and would like to do the following:
1) Via the command line (Terminal Emulator), open up a downloaded app (call it Lyft)
2) Interact with the app as if I were a user working with the app normally on a phone --
2a) Pass my username/password to log in
OR
2b) Pass in new account credentials to create a new account
I imagine this thing is possible, given that Android is just a modified version of Linux but I'm not entirely sure where to get started. How could one do this sort of thing to emulate the experience of using the mobile app, without an API and without actually touching a phone?
You can use AndroidViewClient/culebra to create a script that does all you want. culebra --gui can also be used to create the script just pointing and clicking on the UI (check https://github.com/dtmilano/AndroidViewClient/wiki/Culebra-GUI).
You can launch the app , but accessing input fields is possible if the login form fields request focus immediately after launching . Otherwise , an interaction to click on the form field is a must
For launching the app , go to the android sdk directory or if its added to the path - connect the phone and run
adb shell
adb shell monkey -p com.android.chrome -c android.intent.category.LAUNCHER 1
where com.android.chrome should be replaced by the package name of the app you want to launch
I have created a batch file that fires adb shell command to start activity, send events to enter text into username and password text fields & click login buttons to navigate to other activity(screen).
how can i know that application navigate to other activity or want to know the response that tell me if login successful or not using shell commands.
Thanks,
Bhushan
Dollop, where I work, provides a record-and-play-back tool for Android that will do the things you suggest and save you the hassle of interacting with low-level shell commands. (It is currently limited to running on Windows in communication with Android devices). It's easy to configure and use, requires no programming, runs against real devices (which do NOT have to be rooted) and automatically saves screenshots as it plays tests. I'd love to hear your feedback.
try to get process (ps aux | grep xxxxx ) information to know the activity running or not
I am developing an application and during my testing on a real device I have found that it will crash and cause the phone to reboot (worrying I know...)
Is there any way I retrieve the logcat from before the phone rebooted as the logcat seems to reset when the phone boots up.
Thanks in advance.
Use http://code.google.com/p/acra/, which is a great lib to send crash reports to a google form incl. stack trace. I use it in my app and works nicely. Let me know if you have any difficulties implementing it.
Read the http://code.google.com/p/acra/wiki/ACRAHowTo, it's easy to setup.
From slashfoo's blog, (check the logcat page for exact syntax)
hook up your computer to start off the logcat process in the background.
adb shell nohup logcat -f /dev/[your sdcard] -n60 -r3600
Although it means logcat will be saved to the sdcard but every time you reboot, you must perform the procedure again.
Easiest way:
Get aLogrec from Market for free.
This app saves the logs to sdcard.
Use the alogrec program. It writes the log to the SD card, and will automatically resume after rebooting.
Updating for 2019, Fabric, which was purchased by Google, does an excellent job of remote logging app crashes. Integration into the app was simple, and it is free (at least at whatever level I'm using it).
It has been extremely valuable to finding defects in my apps.
https://www.fabric.io
Try to open a terminal/command prompt and issue this in it :
adb -d logcat
This should dump you a live version of the logcat you could read to find the problem