파이썬에서 uiautomator 덤프를 내 컴퓨터에 직접 저장하는 방법을 알려주십시오.

파이썬에서 uiautomator 덤프를 내 컴퓨터에 직접 저장하는 방법을 알려주십시오.

더시민 0 181 0

import subprocess

# Run the adb command to save the dump to a file
subprocess.run(['adb', 'shell', 'uiautomator', 'dump', '/sdcard/dump.xml'])

# Pull the file from the device to the computer
subprocess.run(['adb', 'pull', '/sdcard/dump.xml', 'dump.xml'])

# Read the file into your Python script
with open('dump.xml', 'r') as f:
    dump = f.read()

# Print the dump
print(dump)
 

이제 Python에서 uiautomator 덤프를 컴퓨터에 직접 저장하는 방법을 알아보았습니다. subprocess 모듈을 사용하여 adb 명령을 실행하여 덤프를 파일로 저장하고, 그 파일을 Python 스크립트에서 읽어들일 수 있습니다.

 

0 Comments
제목
Category
Facebook Twitter GooglePlus KakaoStory KakaoTalk NaverBand