android--to execute script files on the PC via monkey on the phone

Source: Internet
Author: User

Monkey Relatively simple, I have also written an article about sending instructions to the specified app to do automated pressure measurement

Try.

So what if we don't want to send instructions in batches and do thousands of scripts that we write?

Let us introduce the script file method written on the PC:

    • Write the script first and put it under a path.

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/98/55/wKioL1k6QYeAA0PjAACVBcdpn5E317.png-wh_500x0-wm_ 3-wmp_4-s_3274201374.png "title=" script. png "alt=" wkiol1k6qyeaa0pjaacvbcdpn5e317.png-wh_50 "/>

Here are some random scripts to write your own scripts according to your needs.

    • Verify that the Android device is connected successfully with the ADB command

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/98/55/wKioL1k6QZLCtN43AAAobLTwcW8362.png-wh_500x0-wm_ 3-wmp_4-s_3483675465.png "title=" verifies whether the device is linked. png "alt=" wkiol1k6qzlctn43aaaobltwcw8362.png-wh_50 "/>

If the result is empty, or if the offline requires reseating the device or the process of 5037 Port is killed,

Before you connect the device.

    • after confirming the connection to the device, we upload the file to the phone, and here I upload it to the sdcard directory .

upload file Directive adb push d:\monkey_script.txt/sdcard/

There are spaces between the above instruction words.

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/98/55/wKiom1k6QZ2gEgFMAAAnRmOj3GQ423.png-wh_500x0-wm_ 3-wmp_4-s_3019749025.png "title=" upload file. png "alt=" wkiom1k6qz2gegfmaaanrmoj3gq423.png-wh_50 "/>

This screen shows that the upload was successful. We can also check if there are any files that we have uploaded under this path.

ADB shell enters the phone

then execute cd/sdcard/

See the files that pass

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/98/55/wKiom1k6QaiTdhyGAAAfzXdzlSs133.png-wh_500x0-wm_ 3-wmp_4-s_3446503761.png "title=" SDcard directory. png "alt=" wkiom1k6qaitdhygaaafzxdzlss133.png-wh_50 "/>

    • After confirming that the file has been uploaded to the SDcard directory, start executing the script file

Execute script file directive:adb shell monkey–v 100–f/sdcard/monkey_script.txt

-V is the number of executions that must be written, otherwise it will not execute.

-F is the file to be executed

The log will be printed in real-time after execution, and the phone will be automatically operated

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/98/55/wKioL1k6QbXhv05VAAG9uYcwBBU087.png-wh_500x0-wm_ 3-wmp_4-s_1630529203.png "title=" execution complete log.png "alt=" Wkiol1k6qbxhv05vaag9uycwbbu087.png-wh_50 "/>

This is the real-time log.

If you have a problem, you can communicate. QQ Group: 610845268


This article is from the "It Bug" blog, so be sure to keep this source http://laomomo.blog.51cto.com/6595318/1933794

android--to execute script files on the PC via monkey on the phone

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.