iOS常用命令

时间:2024-03-23 20:14:09

记录下复工第一天:整个项目小组就只有4个人满足办公室工作,其余人家里远程办公。
还是在办公室办公效率高,在家里容易受干扰分心。
依然想念战战,一起越来越优秀,好好工作,静等“战”归来!
iphone6s显示屏:1334***750
Iphone6splus:1920***1080

00008020-000C499xxxxx

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ‘id=00008020-000C4994xxxxx’ test
1.查看设备UDID:
tadeMacBook-Pro:~ ta$ idevice_id -l

查看当前设备的所有信息:instruments -s devices
查看手机上所有第三方设备信息:ideviceinstaller -l

com.taobao.taobao4iphone - 手机淘宝 12152155

查看系统的软件:ideviceinstaller -l -o list_system
com.apple.calculator - 计算器 1.0
com.apple.mobilecal - 日历 1.0

self.driver.hide_keyboard(‘Done’)

2.修改WebAgent的bunldID
1.15
/Applications/Appium.app/Contents/Resources/app/node_modules/appium-webdriveragent

1.16
/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent

进入到WDA 根目录

cd appium-webdriveragent/

运行初始化脚本

./Scripts/bootstrap.sh

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ‘id=9ec95901f94f4e002f68a5axxx2ff82e37exxxxx0’ test

product Bundle identifier — com.myselffacebook.WebDriverAgentLib

npm cache clean -f

, exclude: /node_modules/

mac 终端指令集合 https://blog.csdn.net/ysy441088327/article/details/7890879

注意:我在Facebook下载的webdriveragent ,.sh安装一直报错,但是在appium上下载的,成功运行。appium上的包比facebook的大,多了TVOS,但是没有影响

Xcode端配置,参考 https://www.cnblogs.com/Owen-ET/p/9792146.html
https://testerhome.com/topics/8085
https://testerhome.com/topics/7220

3.JAVA安装的地址
/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home

http://appium.io/docs/en/drivers/ios-xcuitest/

###以下两种方式是一个意思######为启动appium真机报错日志
/Users/taiping/Library/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Logs/Test/

⁨Macintosh HD⁩ ▸ ⁨用户⁩ ▸ ⁨tade ▸ ⁨资源库⁩ ▸ ⁨Developer⁩ ▸ ⁨Xcode⁩ ▸ ⁨DerivedData⁩ ▸ ⁨WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs⁩ ▸ ⁨Logs⁩ ▸ ⁨Test⁩

Macintosh HD⁩ ▸ ⁨应用程序⁩ ▸ ⁨Appium⁩ ▸ ⁨Contents⁩ ▸ ⁨Resources⁩ ▸ ⁨app⁩ ▸ ⁨node_modules⁩/appium-webdriveragent

/Applications/Appium.app/Contents/Resources/app/node_modules/WebDriverAgent

在网页输入:http://169.254.190.2xxx:8100/status
执行会出现json字串

{
“value” : {
“message” : “WebDriverAgent is ready to accept commands”,
“state” : “success”,
“os” : {
“name” : “iOS”,
“version” : “11.4.1”,
“sdkVersion” : “13.0”
},
“ios” : {
“simulatorVersion” : “11.4.1”,
“ip” : “169.254.xxxx”
},
“ready” : true,
“build” : {
“time” : “Nov 7 2019 14:28:46”,
“productBundleIdentifier” : “com.facebook.WebDriverAgentRunner”
}
},
“sessionId” : “E2CD8817-420F-48A1-8AAF-ED4A524D207C”
}

4.iOS常用命令
如何修改文件夹的子文件问可读可写??
cd 你的文件夹路径的上一级目录。
sudo chmod -R 777 你的文件夹名。
输入密码即可

libimobiledevice / ideviceinstaller 库,相当于 android 的 adb,是 Appium 底层用到的工具之一,用于获取 iOS 设备信息。
其常用命令如下:

查看当前所连接的设备

idevice_id -l # 显示当前所连接设备的 udid
instruments -s devices # 列出所有设备,包括真机、模拟器、mac

安装应用

ideviceinstaller -u [udid] -i [xxx.ipa] # xxx.ipa 为应用在本地的路径

卸载应用

ideviceinstaller -u [udid] -U [bundleId]

查看设备已安装的应用

ideviceinstaller -u [udid] -l # 查看设备安装的第三方应用
ideviceinstaller -u [udid] -l -o list_user # 同上,查看设备安装的第三方应用
ideviceinstaller -u [udid] -l -o list_system # 查看设备安装的系统应用
ideviceinstaller -u [udid] -l -o list_all # 查看设备安装的所有应用

获取设备信息

ideviceinfo -u [udid] # 获取设备信息
ideviceinfo -u [udid] -k DeviceName # 获取设备名称 同命令 idevicename
idevicename # 同上
ideviceinfo -u [udid] -k ProductVersion # 获取设备版本 10.3.3
ideviceinfo -u [udid] -k ProductType # 获取设备类型 iPhone 8,1
ideviceinfo -u [udid] -k ProductName # 获取设备系统名称

其他系统文件信息

ideviceinfo # 获取设备所有信息
idevicesyslog # 获取设备日志
idevicecrashreport -e test # 获取设备 crashlog,test 是文件夹需新建
idevicediagnostics # 管理设备状态 - 重启、关机、睡眠等

ios-deploy 常用命令

ios-deploy -c # 查看当前链接的设备
ios-deploy --[xxx.app] # 安装APP
ios-deploy --id [udid] --uninstall_only --bundle_id [bundleId] # 卸载应用
ios-deploy --id [udid] --list_bundle_id # 查看所有应用
ios-deploy --id [udid] --exists --bundle_id # 查看应用是否安装

carthage,项目依赖管理,主要是 WebDriverAgent 使用,WebDriverAgent 是用它做项目依赖的;

公司 iOS 项目也使用 carthage,类似于 java 的 maven;

ios-deploy、ideviceinstaller 类似 android 的 adb;

authroize-ios,iOS 授权工具,主要用于模拟器中一些权限的授权;

npm install -g authroze-ios
sudo authroze-ios

‘/Library/Application Support/Jenkins/Uninstall.command’
ahongxxx9900xxx
iOS常用命令