问题
I am new to UIAutomator for android devices. I am writing these scripts in eclipse IDE using JAVA.
I need one sample script for automating call scenario where i call from one phone and recieve the call from another phone and then i am browsing from first phone. Can we do this from one single script ?
回答1:
As Uiautomator scripts run from the device under test, it would not be possible to test call-receive scenario using UIautomator framework. Instead have a look at android MonkeyRunner framework. MonkeyRunner will allow you to control multiple devices from your PC.
回答2:
There is also a python wrapper for uiautomator. This might help you with your task. You run the single python script to automate steps and the wrapper pushes a standard jar to each defined device (in theory).
You could take a look here: https://github.com/xiaocong/uiautomator
UPDATE:
For Linux based OS you can use:
sudo apt-get install python-pip
sudo pip install urllib3
sudo pip install uiautomator
For Windows please take a look at this question: How do I install pip on Windows?
回答3:
Its true what Rishi said and would like to add something to it. There is another open source tool called appium which can be used to handle such kind of scenarios. With UiAutomator you cannot interact with 2 devices in a single test, but you can break single test into 2 and run 1 test on one device and another on test on another devices. At the end you can parse the test result and make sure once both test passes then your whole scenario passes
来源:https://stackoverflow.com/questions/27225178/how-to-script-mo-call-and-browsing-on-2-devices-from-uiautomator-for-android-dev