第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

有沒有辦法通過adb獲取當(dāng)前活動(dòng)的布局和視圖?

有沒有辦法通過adb獲取當(dāng)前活動(dòng)的布局和視圖?

手掌心 2019-09-03 16:08:53
出于環(huán)境原因,我只能使用adb命令。有沒有一種方法來獲得當(dāng)前的布局屬性,如id,position,text等?與uiautomatorviewer顯示的相似。
查看完整描述

3 回答

?
慕妹3242003

TA貢獻(xiàn)1824條經(jīng)驗(yàn) 獲得超6個(gè)贊

使用adb shell uiautomator dump命令:


Usage: uiautomator <subcommand> [options]


Available subcommands:


help: displays help message


runtest: executes UI automation tests

    runtest <class spec> [options]

    <class spec>: <JARS> < -c <CLASSES> | -e class <CLASSES> >

      <JARS>: a list of jar files containing test classes and dependencies. If

        the path is relative, it's assumed to be under /data/local/tmp. Use

        absolute path if the file is elsewhere. Multiple files can be

        specified, separated by space.

      <CLASSES>: a list of test class names to run, separated by comma. To

        a single method, use TestClass#testMethod format. The -e or -c option

        may be repeated. This option is not required and if not provided then

        all the tests in provided jars will be run automatically.

    options:

      --nohup: trap SIG_HUP, so test won't terminate even if parent process

               is terminated, e.g. USB is disconnected.

      -e debug [true|false]: wait for debugger to connect before starting.

      -e runner [CLASS]: use specified test runner class instead. If

        unspecified, framework default runner will be used.

      -e <NAME> <VALUE>: other name-value pairs to be passed to test classes.

        May be repeated.

      -e outputFormat simple | -s: enabled less verbose JUnit style output.


dump: creates an XML dump of current UI hierarchy

    dump [--verbose][file]

      [--compressed]: dumps compressed layout information.

      [file]: the location where the dumped XML should be stored, default is

      /storage/emulated/legacy/window_dump.xml


events: prints out accessibility events until terminated

默認(rèn)情況下,它會(huì)將視圖層次結(jié)構(gòu)轉(zhuǎn)儲(chǔ)到 $EXTERNAL_STORAGE/window_dump.xml


adb shell uiautomator dump

UI hierchary dumped to: /sdcard/window_dump.xml

通常,您可能希望將該文件提取到PC進(jìn)行進(jìn)一步處理,這將是一個(gè)額外的步驟。但是有一個(gè)巧妙的技巧,它允許將轉(zhuǎn)儲(chǔ)和拉入組合成一個(gè)命令。使用/dev/tty轉(zhuǎn)儲(chǔ)目標(biāo)將生成一個(gè)命令,將整個(gè)轉(zhuǎn)儲(chǔ)打印到stdout:


adb exec-out uiautomator dump /dev/tty

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><hierarchy rotation="0"><node ...></node></hierarchy>UI hierchary dumped to: /dev/tty



查看完整回答
反對(duì) 回復(fù) 2019-09-03
  • 3 回答
  • 0 關(guān)注
  • 2395 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)