当前位置:网站首页>Appium自动化测试基础 — ADB常用命令(三)
Appium自动化测试基础 — ADB常用命令(三)
2022-06-29 06:39:00 【测试-八戒】
10、发送⽂件到⼿机
adb命令:adb push 电脑端⽂件路径\需要发送的⽂件(全名) /⼿机端存储的路径
提示:
- Android手机存储卡的根目录都是
sdcard目录。(固定死的) - 注意目录中斜杠的方向。
示例:
将桌⾯的test.txt文件发送到⼿机sdcard⽬录下
C:\Users\L>adb push C:\Users\L\Desktop\test.txt /sdcard
C:\Users\L\Desktop\test.txt: 1 file pushed, 0 skipped. 0.0 MB/s (36 bytes in 0.003s)
C:\Users\L>提示:我们可以把文件直接拖拽到命令行终端中,该文件的路径和文件名会自动生成。
我们再到Android模拟器中的文件管理器查看test.txt文件是否接收到。

打开文件的内容也是一样的。
11、从⼿机拉取⽂件
adb命令:adb pull ⼿机端的路径/拉取⽂件名(全面) \电脑端存储⽂件路径
示例:
将⼿机/sdcard⽬录中的test.txt⽂件,发送到电脑桌⾯
C:\Users\L>adb pull /sdcard/test.txt C:\Users\L\Desktop
/sdcard/test.txt: 1 file pulled, 0 skipped. 0.0 MB/s (36 bytes in 0.002s)
C:\Users\L>桌面上会接收到test.txt⽂件。
注意:练习的时候,文件名尽量不要使用中文,可能测试效果不好。
12、查看⼿机运⾏⽇志
adb命令:adb logcat
只要对Android手机/模拟器的操作,都会记录到日志中。
Android 系统的日志分为两部分,底层的 Linux 内核日志输出到 /proc/kmsg,Android 的日志输出到 /dev/log。
(1)Android 日志
命令格式:
[adb] logcat [<option>] ... [<filter-spec>] ...常用用法列举如下:
(2)按级别过滤日志
Android 的日志分为如下几个优先级(priority):
- V —— Verbose(最低,输出得最多)
- D —— Debug
- I —— Info
- W —— Warning
- E —— Error
- F —— Fatal
- S —— Silent(最高,啥也不输出)
按某级别过滤日志则会将该级别及以上的日志输出。
比如,命令:
adb logcat *:W会将 Warning、Error、Fatal 和 Silent 日志输出。
(注: 在 macOS 下需要给 *:W 这样以 * 作为 tag 的参数加双引号,如 adb logcat "*:W",不然会报错 no matches found: *:W。)
(3)按 tag 和级别过滤日志<filter-spec> 可以由多个 <tag>[:priority] 组成。
比如,命令:
adb logcat ActivityManager:I MyApp:D *:S
表示输出 tag ActivityManager 的 Info 以上级别日志,输出 tag MyApp 的 Debug 以上级别日志,及其它 tag 的 Silent 级别日志(即屏蔽其它 tag 日志)。
(4)日志格式
可以用 adb logcat -v <format> 选项指定日志输出格式。
日志支持按以下几种 <format>:
- brief
默认格式。格式为:
<priority>/<tag>(<pid>): <message>
示例:
D/HeadsetStateMachine( 1785): Disconnected process message: 10, size: 0 - process
格式为:
<priority>(<pid>) <message>
示例:
D( 1785) Disconnected process message: 10, size: 0 (HeadsetStateMachine) - tag
格式为:
<priority>/<tag>: <message>
示例:
D/HeadsetStateMachine: Disconnected process message: 10, size: 0 - raw
格式为:
<message>
示例:
Disconnected process message: 10, size: 0 - time
格式为:
<datetime> <priority>/<tag>(<pid>): <message>
示例:
08-28 22:39:39.974 D/HeadsetStateMachine( 1785): Disconnected process message: 10, size: 0 - threadtime
格式为:
<datetime> <pid> <tid> <priority> <tag>: <message>
示例:
08-28 22:39:39.974 1785 1832 D HeadsetStateMachine: Disconnected process message: 10, size: 0 - long
格式为:
[ <datetime> <pid>:<tid> <priority>/<tag> ] <message>
示例:
[ 08-28 22:39:39.974 1785: 1832 D/HeadsetStateMachine ] Disconnected process message: 10, size: 0
指定格式可与上面的过滤同时使用。比如:
adb logcat -v long ActivityManager:I *:S
(5)清空日志
命令如下:
adb logcat -c
重点:配套学习资料和视频教学
那么在这里我也精心准备了上述大纲的详细资料在下方链接如下


边栏推荐
- idea控台中文乱码问题【亲测有效】
- Crawler data analysis (introduction 2-re analysis)
- Use of parameter in Simulink for AUTOSAR SWC
- Markdown 技能树(7):分隔线及引用
- 帆船动力学仿真分析
- Markdown 技能树(1):MarkDown介绍
- 【FreeRTOS】中断机制
- The realization of changing pop-up background at any time
- Shift/space studio "Aurora" project: building a villa in the sandbox metauniverse
- Ci tool Jenkins II: build a simple CI project
猜你喜欢

Imx6dl4.1.15 supports EIM bus (upper) - actual operation and modification.

Crawler data analysis (introduction 2-re analysis)

数字ic设计——UART

YGG cooperated with Web3 platform leader to empower the creative community with Dao tools and resources

树形下拉选择框el-select结合el-tree效果demo(整理)
![[translation] E-Cloud. Large scale CDN using kubeedge](/img/ac/178c078589bb5bc16dbdc8f4ae9525.png)
[translation] E-Cloud. Large scale CDN using kubeedge

WordPress adds article topping, password protection, and privacy Tags
![[QNX Hypervisor 2.2用户手册]6.2.1 Guest之间通信](/img/3d/6a0cde206a09a7ef03038fb99cf532.png)
[QNX Hypervisor 2.2用户手册]6.2.1 Guest之间通信

Domestic code hosting center code cloud

tf.count_nonzero
随机推荐
E-commerce is popular, how to improve the store conversion rate?
Markdown 技能树(7):分隔线及引用
Utilisation d'IPv6 pour réaliser l'accès public au bureau distant
Instanceklass "suggestions collection" of hotspot class model
BeanPostProcessor 和 BeanFactoryPostProcessor
Who is the main body of the waiting insurance record? Record in the local network security, right?
树形下拉选择框el-select结合el-tree效果demo(整理)
[translation] [Chapter II ①] mindshare PCI Express technology 3.0
tf.count_nonzero
Tree drop-down selection box El select combined with El tree effect demo (sorting)
Markdown skill tree (1): introduction to markdown
uva10635
golang 修改 结构体切片的值
[translation] how Bink drives the digital loyalty transactions of some of the largest banks in the UK
【翻译】Bink如何为英国一些最大的银行的数字忠诚度交易提供动力
Relevance - correlation analysis
通过keyup监听textarea输入更改按钮样式
JVM系列之对象深度探秘
Shift/space studio "Aurora" project: building a villa in the sandbox metauniverse
Markdown 技能树(4):链接