Hi,
I am doing automation testing for an android device.
So I want to read the device number from command prompt to a string variable in my script.
Command 'adb devices' will list all the devices connected but I am not sure how to pass this command from my script and retrive the device number in my script.
Can anyone guide me how to pass command in command prompt and read data from command prompt?
Thanks,
Rakesh
Read data from Command Prompt
Re: Read data from Command Prompt
If I understand you right, you want to use the list of devices provided by "adb devices" command to run test for each single device from that list? I don't think there is an easy/single-line solution of this problem.
What you need to do first is to save the list of devices to file. This should be the easiest part
You can try something like this:
Now you need to parse the file to extract each single device ID and pass that ID to Ranorex command line. I think it would be too much work trying to achieve this from command line? I would personally use AutoIt to extract the device ID and pass it to Ranorex command line. But of course, you can use any scripting tool you want.
What you need to do first is to save the list of devices to file. This should be the easiest part

This should save the list of devices to output.txt file.adb devices > c:\output.txt
Now you need to parse the file to extract each single device ID and pass that ID to Ranorex command line. I think it would be too much work trying to achieve this from command line? I would personally use AutoIt to extract the device ID and pass it to Ranorex command line. But of course, you can use any scripting tool you want.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration