When Monkeyrunner do automated tests, you can use the simulator, of course, you can also choose to use the real machine. However, to install software through the computer, mobile phone, you must first install mobile phone driver, and the general mobile phone connected to the computer, the computer will automatically start downloading drivers. However, you often encounter the problem of "failure to install drivers successfully". The general driver installation failed and we need to install it manually.
The handset developer option, turns on the USB debugging, we here take mx3 as example, other handset model like, uses the data line to connect the handset and the computer, the computer in the lower right corner will display "The drive installs", after several seconds, unexpectedly prompts "failed installs the drive".
At this point, we need to first download the MX3 phone driver on the Internet, and extract the saved to the folder. Other models of mobile phones also download the same type of drive. After the download was successful, we started the real manual installation drive.
Right-click on "My Computer", select "Manage" and click "Device Manager" on the left.
Or, directly in the control Panel, search Device Manager and click Device Manager.
At this point, we will see the "Android phone" has a yellow exclamation, this is our mobile device. The following figure:
Here we start to install the driver, right click on the exclamation point of the item, select "Update Driver software", select "Browse the computer to find driver software", the following figure:
Browse and select the driver path that we just downloaded, and then click Next to install the driver automatically.
After installation, click Close, and then you can see the "Android Phone" item on the exclamation point has been gone, indicating that the driver has been installed.
Finally, in the cmd window, we check to see if the Android phone is connected to the computer. Window+r Key run cmd, in the cmd window, enter "ADB devices", you can see the results, showing the connected Android devices. The driver installation is successful and you can then use Monkeyrunner to test on the real machine.
Note that if several devices are connected to the computer at the same time, the command to connect to the device should be added with the following parameters:
Device=monkeyrunner.waitforconnection (6, ' emulator-5554′)
parameter 1: timeout, unit seconds, floating-point number, default is to wait indefinitely.
Parameter 2: the specified device name device_id, defaults to the current device (cell phone priority, followed by the simulator)
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.