Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to get platformVersion, deviceName, appPackage

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to get platformVersion, deviceName, appPackage". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to get platformVersion, deviceName, appPackage".

The command is obtained as follows:

Connect the mobile phone to the computer

Devicename: adb devices

Platformversion: adb shell getprop ro.build.version.release

AppPackage: aapt dump badging installation package address

AppActivity: open appk and enter the command

Adb shell "dumpsys window | grep mCurrentFocus"

The code is obtained as follows:

#-*-coding: utf-8-*-

From appium import webdriver

# filter device id using regular expressions

Import re

# using the time.sleep (xx) function to wait

From time import sleep

# using os module to invoke commands

Import os

# path and package name of the package tested

AppLocation = "C:\ Users\\ Administrator\\ Desktop\\ xxxx_151.apk"

# read device id

Read_DeviceId = list (os.popen ('adb devices'). Readlines ())

'' execute the cmd command to save the result as a list read_DeviceId''

Print read_DeviceId

Device_Id=read_DeviceId [1] .split ('\ t') [0]

Take the second item in the list, split the string, and take the first item in the sliced list

There is a problem here. If multiple devices are connected, you can only deal with the first one.

See here that regular implementations are available?

''

Print device_Id

# read the device system version number

Device_Android_Version = list (os.popen ('adb shell getprop ro.build.version.release'). Readlines ())

Print device_Android_Version

Device_Version=device_Android_Version [0] .split ('\ r\ n') [0]

Print device_Version

# read package information of APK

AppPackageAdb = list (os.popen ('aapt dump badging' + appLocation) .readlines ())

AppPackage = re.findall (r'\ 'com\ winter.shipping?\', appPackageAdb [0]) [0]

Print appPackage

Thank you for reading, the above is "how to get platformVersion, deviceName, appPackage" content, after the study of this article, I believe you have a deeper understanding of how to obtain platformVersion, deviceName, appPackage this problem, the specific use of the situation also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report