Appium-Using ios-webkit-debug-proxy(使用iOS-webkit调试代理)

马坚白
2023-12-01


For accessing web views on real iOS device appium uses ios_webkit_debug_proxy.

为访问web view在实体iOS device上
Appium使用ios_webkit_debug_proxy.
Installation
Using Homebrew

To install the latest tagged version of the ios-webkit-debug-proxy using Homebrew, run the following commands in the terminal:

要安装最新版本使用自制的ios-webkit-debug-proxy,
在终端中运行命令:

shell # The first command is only required if you don't have brew installed. $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" $ brew update $ brew install ios-webkit-debug-proxy

Building ios-webkit-debug-proxy from source

Open the command terminal on your linux machine. You can find instructions on how to open the terminal via your favorite search engine.

打开命令终端在你的Linux机器上.
在你的偏好的搜索引擎上你可以找到如何打开终端的说明.
$ cd  ~
$ sudo apt-get install autoconf automake libusb-dev libusb-1.0-0-dev libplist-dev libplist++-dev usbmuxd libtool libimobiledevice-dev
$ git clone https://github.com/google/ios-webkit-debug-proxy.git
$ cd ios-webkit-debug-proxy
$ ./autogen.sh
$ make
$ sudo make install
Running ios-webkit-debug-proxy

Once installed you can start the proxy with the following command:

安装后你可以启动代理用以下命令
# Change the udid to be the udid of the attached device and make sure to set the port to 27753
# as that is the port the remote-debugger uses. You can learn how to retrieve the UDID from
# Apple's developer resources.
> `ios_webkit_debug_proxy -c 0e4b2f612b65e98c1d07d22ee08678130d345429:27753 -d`

You can also set the desired capability called startIWDP to true (see the desired capabilities docs). This will run the above command as a subprocess from within Appium and will set the udid, so you don’t have to run ios_webkit_debug_proxy yourself anymore. It monitors the proxy for crashes and relaunches when needed.

你也可以设置期望功能名为 `startIWDP`设置为'true'
(请参阅desired capabilities文档).
这将运行上述命令作为Appium得子进程,将设置uuid,
所以你不必再自己运行 ios_webkit_debug_proxy.
它监视代理的崩溃并再需要时重新启动.
// example desired capabilities
{
  "browserName": "Safari",
  "platformName": "iOS",
  "deviceName": "iPhone 7",
  "automationName": "XCUITest",
  "startIWDP": true,
  "udid": "auto"
}

You may also use ios-webkit-debug-proxy-launcher, a small script included with the Appium codebase, to launch the proxy. It monitors the proxy log for errors, and relaunch the proxy where needed. This is also optional and may help with recent devices:

你也可以用'ios-webkit-debug-proxy-launcher',
Appium codebase中的一个小脚本,来启动代理.
它监视代理日志中的错误,
并在需要的时候重启代理.
这是也可以选择的并且可能帮助使用最新的设备.
# change the udid
# note, this is run from an Appium repository
> ./bin/ios-webkit-debug-proxy-launcher.js -c 0e4b2f612b65e98c1d07d22ee08678130d345429:27753 -d

NOTE: the proxy requires the “web inspector” to be turned on to allow a connection to be established. Turn it on by going to settings > safari > advanced.

注意:代理需要'web inspector'是打开的在允许连接的.
通过'settings > safari > advanced'打开它.
Specifying non-default port

Appium expects ios-webkit-debug-proxy to be running on port 27753. If, for whatever reason, this needs to be changed, the webkitDebugProxyPortdesired capability can be set with the port on which it the proxy is running.

Appium要求ios-webkit-debug-proxy去运行端口27753上.
如果,不管什么原因,需要更改,
webkitDebugProxyPort所需功能可以设置代理运行的端口.
 类似资料: