Skip to content

Commit 326cadd

Browse files
authored
Merge pull request #257 from floatingstarZ/hzy_1220
完善IOS配置文档
2 parents 1ab6e1e + ab66e47 commit 326cadd

9 files changed

Lines changed: 137 additions & 44 deletions

README.md

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -105,52 +105,11 @@ ADB 调试能力,可通过 WiFi 或网络连接设备,实现灵活的远程
105105

106106
## iPhone 环境准备
107107

108-
### 1. Python 环境
109-
110-
建议使用 Python 3.10 及以上版本。
111-
112-
### 2. 设置 WebDriverAgent
113-
114-
WebDriverAgent 是 iOS 自动化的核心组件,需要在 iOS 设备上运行。
115-
116-
注意:需要提前安装好Xcode、并注册好苹果开发者账号(不需要付费)
117-
118-
#### 1. 克隆 WebDriverAgent
119-
120-
```bash
121-
122-
git clone https://github.com/appium/WebDriverAgent.git
123-
cd WebDriverAgent
124-
```
125-
在 Xcode 中打开WebDriverAgent.xcodeproj
126-
127-
#### 2. 设置 Signing & Capabilities
128-
129-
![设置签名](resources/setup-xcode-wda.png)
130-
131-
把Bundle ID改成 YOUR_NAME.WebDriverAgentRunner。
132-
133-
#### 3. 开始UI测试
134-
135-
需要在Finder勾选过“在WiFi中显示这台iPhone”,且Mac与iPhone处于同一WiFi网络之下,可以不用连接数据线,即可在设备中选择到。
136-
137-
**注意:** 不建议插数据线运行,因为插数据线还必须要同时运行iproxy才可以把端口映射出来,不及直接WiFi运行稳定。
138-
139-
先从项目Target选择WebDriverAgentRunner,然后再选择你的设备。
140-
141-
![选择设备](resources/select-your-iphone-device.png)
142-
143-
选好后,长按"▶️"运行按钮选择“Test”后开始编译并部署到你的iPhone上。
144-
145-
![信任设备](resources/start-wda-testing.png)
146-
147-
这时需要你在iPhone上输入解锁密码,在设置 -> 通用 -> VPN与设备管理 中信任开发者App,还需要在 设置 -> 开发者 中,打开UI自动化设置。
148-
149-
108+
如果你使用的是 iPhone 设备,请参考专门的 iOS 配置文档:
150109

151-
![信任设备](resources/trust-dev-app.jpg)
110+
📱 [iOS 环境配置指南](docs/ios_setup/ios_setup.md)
152111

153-
![启用UI自动化](resources/enable-ui-automation.jpg)
112+
该文档详细介绍了如何配置 WebDriverAgent 和 iPhone 设备,以便在 iOS 上使用 AutoGLM。
154113

155114
## 部署准备工作
156115

docs/ios_setup/ios_setup.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# iOS 环境配置指南
2+
3+
本文档介绍如何为 Open-AutoGLM 配置 iOS 设备环境。
4+
5+
## 环境要求
6+
7+
- macOS 操作系统
8+
- Xcode(最新版本,在App store中下载)
9+
- 苹果开发者账号(免费账号即可,无需付费)
10+
- iOS 设备(iPhone/iPad)
11+
- USB 数据线或同一 WiFi 网络
12+
13+
14+
## WebDriverAgent 配置
15+
16+
WebDriverAgent 是 iOS 自动化的核心组件,需要在 iOS 设备上运行。
17+
18+
### 1. 克隆 WebDriverAgent
19+
20+
```bash
21+
git clone https://github.com/appium/WebDriverAgent.git
22+
cd WebDriverAgent
23+
```
24+
25+
直接点击`WebDriverAgent.xcodeproj`即可使用Xcode打开。
26+
27+
### 2. 设置 Signing & Capabilities
28+
29+
1. 在 Xcode 中选中 `WebDriverAgent`,出现General、Signing&Capabilities等选项。
30+
2. 进入 `Signing & Capabilities` 选项卡
31+
3. 勾选 `Automatically manage signing`。在Team中选择自己的开发者账号
32+
4. 将 Bundle ID 改为唯一标识符,例如:`com.yourname.WebDriverAgentRunner`
33+
![设置签名1](resources/ios0_WebDriverAgent0.png)
34+
35+
5. TARGETS中,建议将WebDriverAgentLib、WebDriverAgentRunner、IntegrationApp的`Signing & Capabilities` 都按照相同方式设置。
36+
![设置签名1](resources/ios0_WebDriverAgent1.png)
37+
38+
### 3. 测试XCode的GUI模式和UI自动化设置
39+
40+
建议先测试GUI模式能否成功安装WebDriverAgent,再进行后续步骤。
41+
Mac和iPhone有USB和WiFi两种连接方式,建议通过USB方式,成功率更高。
42+
43+
#### 通过 WiFi 连接
44+
45+
需要满足以下条件:
46+
1. 通过USB连接。在Finder中选中连接的IPhone,在“通用”中勾选"在 WiFi 中显示这台 iPhone"
47+
2. Mac 与 iPhone 处于同一 WiFi 网络之下
48+
49+
#### 具体步骤
50+
1. 从项目 Target 选择 `WebDriverAgentRunner`
51+
2. 选择你的设备
52+
53+
![选择设备](resources/select-your-iphone-device.png)
54+
55+
3. 长按"▶️"运行按钮,选择 "Test" 后开始编译并部署到你的 iPhone 上
56+
57+
![开始测试](resources/start-wda-testing.png)
58+
59+
部署成功的标志:1. XCode没有报错。2. 你可以在iPhone上找到名为WebDriverAgentRunner的App
60+
61+
#### 设备信任配置
62+
63+
首次运行时,需要在 iPhone 上完成以下设置,然后重新编译和部署:
64+
65+
1. **输入解锁密码**
66+
2. **信任开发者应用**
67+
- 进入:设置 → 通用 → VPN与设备管理
68+
- 在“开发者 App”中选择对应开发者
69+
- 点击信任“XXX”
70+
71+
![信任设备](resources/trust-dev-app.jpg)
72+
73+
3. **启用 UI 自动化**
74+
- 进入:设置 → 开发者
75+
- 打开 UI 自动化设置
76+
77+
![启用UI自动化](resources/enable-ui-automation.jpg)
78+
79+
### 4. XCode命令行模式部署
80+
81+
1.安装libimobiledevice,用于与 iPhone / iPad 建立连接与通信。
82+
83+
```
84+
brew install libimobiledevice
85+
# 设备检查
86+
idevice_id -ln
87+
```
88+
2.使用xcodebuild安装WebAgent。命令行也需要进行“设备信任配置”,参考GUI模式下的方法。
89+
90+
```
91+
cd WebDriverAgent
92+
93+
xcodebuild -project WebDriverAgent.xcodeproj \
94+
-scheme WebDriverAgentRunner \
95+
-destination 'platform=iOS,name=YOUR_PHONE_NAME' \
96+
test
97+
```
98+
这里,YOUR_PHONE_NAME可以在xcode的GUI中看到。
99+
WebDriverAgent 成功运行后,会在 Xcode 控制台输出类似以下信息:
100+
101+
```
102+
ServerURLHere->http://[设备IP]:8100<-ServerURLHere
103+
```
104+
105+
同时,观察到手机上安装好了WebDriverAgentRunner,屏幕显示Automation Running字样。
106+
其中,**http://[设备IP]:8100**为WiFi所需的WDA_URL。
107+
108+
## 使用 AutoGLM
109+
110+
以上配置完成后,先打开一个新终端,在后台建立端口映射(使用WiFi连接则不需要):
111+
112+
```bash
113+
iproxy 8100 8100
114+
```
115+
116+
之后,打开一个新终端,通过以下命令使用AutoGLM(WiFi则使用上述获得的WDA_URL):
117+
118+
```bash
119+
python ios.py --base-url "YOUR_BASE_URL" \
120+
--model "autoglm-phone" \
121+
--api-key "YOUR_API_KEY" \
122+
--wda-url http://localhost:8100 \
123+
"TASK"
124+
```
125+
126+
## 参考资源
127+
128+
- [WebDriverAgent 官方仓库](https://github.com/appium/WebDriverAgent)
129+
- [PR141](https://github.com/zai-org/Open-AutoGLM/pull/141)
130+
- [Gekowa提供的ios方案](https://github.com/gekowa/Open-AutoGLM/tree/ios-support)
131+
132+
---
133+
134+
如有其他问题,请参考主项目 README 或提交 Issue。
92.7 KB
Loading
1.13 MB
Loading
581 KB
Loading
166 KB
Loading
131 KB
Loading
58.7 KB
Loading
177 KB
Loading

0 commit comments

Comments
 (0)