Bob's Blog

Web开发、测试框架、自动化平台、APP开发、机器学习等

返回上页首页

Appium运行前获取Desired Capabilities



对于android:

devicename:    adb devices 

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

appPackage: 1) aapt dump badging 安装包地址 ; 

                     2) 不过我试过用adb logcat > path,然后打开这个保存的文件搜索‘pkg’或者‘package’之类的关键词;

                     3) 用ui automator view识别了当前页面,选择按钮查看属性也能看到package的信息。

appActivity : 打开app,然后输入命令adb shell "dumpsys window | grep mCurrentFocus"  。其实package也可以看到,在一起。

如果设置了unicodeKeyboard和resetKeyboard为true,默认键盘消失了,想再切换到之前的虚拟键盘,要么在移动设备的设置中将默认的键盘改回来,要么执行这两个命令,获取所有输入法,用命令切回。

adb shell ime list -s
    com.samsung.android.honeyboard/.service.HoneyBoardService
    io.appium.settings/.UnicodeIME
adb shell settings put secure default_input_method com.samsung.android.honeyboard/.service.HoneyBoardService

安装apk用:adb install path/xxx.apk

 

对于ios:

bundleId: 1) ideviceinstaller -l来获取手机安装app的bundleId

                2) 如果是ipa文件,后缀改为zip,解压,对里面的app右键选择show package content,找到info.plist,用xcode打开,查看bundle identifier的值。

                3) 如果已经安装上了,运行xcrun simctl listapps booted来查看对应app的BundleIdentifier,也可以运行xcrun simctl listapps {DEVICE_UUID}

udid: 1) 可以访问url获取:http://fir.im/udid 

          2) 如果装了libimobiledevice可以连接手机后运行 idevice_id -l

          3) 真机或模拟器也可以打开xcode,选择菜单Window - Devices and Simulators,选择具体某一个设备,查看identifier的值(上面那个)。

          4) 运行xcrun simctl list devices --json,查看对应的设备的udid值。

          5) 运行ideviceinfo -s也可以得到更多的信息

安装ipa用:scrun simctl install booted path/xxx.ipa

 

appium官方的一些说明:http://appium.io/docs/en/writing-running-appium/caps/

 

另外关于runtime的一些命令

如果想安装离线的runtime文件,可以用:

xcode-select -s /Applications/Xcode.app 

xcodebuild -runFirstLaunch

xcrun simctl runtime add iOS_26_Simulator_Runtime.dmg

如果想删除runtime,可以用:

xcrun simctl runtime list
#== Disk Images ==
#-- iOS --
#iOS 18.6 (22G86) - 66B81F35-D157-49F5-B62D-98220E0A926C (Ready)
#iOS 18.5 (22F77) - 8CD2E8F1-938C-4FFB-B1F5-DBA2C03E82A8 (Ready)

#Total Disk Images: 2 (16.5G)
xcrun simctl runtime delete 22F77
xcrun simctl runtime list
#== Disk Images ==
#-- iOS --
#iOS 18.6 (22G86) - 66B81F35-D157-49F5-B62D-98220E0A926C (Ready)

#Total Disk Images: 1 (8.2G)

如果想导出runtime给别人用,可以用:

xcodebuild -downloadPlatform iOS -exportPath ~/Documents -buildVersion 18.6

https://developer.apple.com/documentation/xcode/downloading-and-installing-additional-xcode-components

下一篇:  ruby在gem list/install时提示编码等错误的解决方法
上一篇:  django本地runserver出现css加载404的问题解决

共有0条评论

添加评论

暂无评论