How to get ADB logs using eggPlant automation tool - android

Can anyone tell me how can we get adb logs using eggPlant automation tool.Actually i want to have adb logs for my device when running eggPlant scripts.
Please help me out in this situation.

Actually, the previous answer is incorrect as adb command support does exist in eggPlant. There are ways to get adb logs in eggPlant. Here's how:
adb logcat is the command that enables getting adb logs. (Warning: This will print a ton of info!)
You need a way to execute adb logcat within eggPlant. This is accomplished using the shell command
On some systems (I am using eggPlant for Windows) you need to dump the output of the shell command to a file and then read the file back into a variable.

I guess there is no such command or something else.eggPlant identifies only object or script to execute the command.

Related

How to execute adb command in Firebase Test Lab prior to a test

I want to enable the logging of some tags during the testing.
How can I execute
adb shell setprop log.tag.GAv4 DEBUG
on the firebase emulator ?
There's currently no way to execute arbitrary adb commands prior to a test in Firebase Test Lab. Feel free to file a feature request to indicate what you're trying to do.
Have you tried executeShellCommand?
https://developer.android.com/reference/android/app/UiAutomation#executeShellCommand(java.lang.String)
Executes a shell command. This method returns a file descriptor that points to the standard output stream. The command execution is similar to running "adb shell " from a host connected to the device.
(Reference: https://github.com/Flank/flank/issues/1808)

uiautomator dump in Runtime.getRuntime().exec() not working

When I put this line in my test app,
Runtime.getRuntime().exec("uiautomator dump"), no .xml file was dumped. I am pretty sure I checked the correct location.
I tried to debug my app by putting a break point. When it reaches the break point, I adb shell on terminal to get into the device, and then manually run uiautomator dump from terminal, then it says killed, no .xml file was produced either.
adb shell uiautomator dump only produces .xml file when I killed my app, and run this command from terminal.
Is this a sort of permission or accessibility problem?
You can't use adb shell uiautomator dump while a test is running.
You can call UiDevice.dumpWindowHierarchy(..) from inside your test instead.

Trying to execute procrank from cmd promt, but not working

I'm trying to get memory info which is allocated by my specific application using "adb shell procrank".
But when i'm trying to execute the procrank command from cmd promt its giving me error like "/system/bin/sh: procrank: not found".
I cant guess what it means!
Thanks in advance.
Procrank is not installed on all devices, you will have to use the following command: "adb shell dumpsys meminfo", it won't give you the memory usage per app, but its an alternative.

Sending AT commands from Powershell script to Android phone via adb

I have a little script that I run in adb shell of Android phone (/system/etc directory), which enables to communicate with the modem by sending/receiving a single AT command.
The script itself, if run in adb shell, works OK. That's what it looks like:
cat /dev/pts/7 &
echo -e $1\\r > /dev/pts/7
Here's the output in adb shell:
# ./sendATCommand "at+cops?"
./sendATCommand "at+cops?"
#
+COPS: 0,0,"AT&T",6
OK
/dev/pts/7: invalid length
(need to press ENTER to return control to adb shell)
#
Now I want to invoke this script from a powershell script running on my PC, thus eventually controlling modem via AT commands, but nothing happens.
For example, the below powershell script will send the command at+cops? to check the operator to which mobile is registered to:
$adb = [IO.Path]::Combine([IO.Path]::Combine($Env:ANDROID, "platform-tools"), "adb.exe")
& $adb remount
$atCommand = "at+cops?"
& $adb shell /system/etc/sendATCommand $atCommand
The output may looks sometimes like +ATCMD (any residual [proprietary]AT command sitting in device buffer after bootup), or at+cops?(echo), or nothing at all, but
never +COPS: 0,0,"AT&T",6 which I expect. Could you help me figure out what's going on and how to possibly fix it? Ideally
I want to be able to execute at command, return control to powershell, and have output available for further processing.
I am also open to other solutions to implement same thing.
Would greatly appreciate your help. Thanks!
Not sure to answer your question, my phone is not an Android, but when I connect it via buetooth or USB to my computer a COM port is created. So I build an assembly tool on the top of .NET SerialPort class that allow, for example, to send SMS using the phone Modem.
I think it's usable in your case.

how to get Logs and write them in files

I want to write all logs displayed in logcat into a file when my application crashes (forced close) or else also.Is there ane way to get Logs programatically ? or is there ane way to know when my application crashed?
I dont want to use "adb logcat " command. Plz help me out
Have a look at this microlog4android
and also go through this question too How do you save an Android application log to a file on a physical device?
Copied "Lars Blumberg" answer for your quick reference:
$ adb shell stop
$ adb shell setprop log.redirect-stdio true
$ adb shell start
Refer for more info: Viewing stdout and stderr
If you want write your own Log function, see this answer Android Writing Logs to text File

Categories

Resources