我可以使用Appium - WebDriver从笔记本电脑(mac)在真实设备(iPhone)上运行应用程序吗?

时间:2021-01-30 20:51:34

I already achieved to run my test cases on the iPhone/iPad Simulator with Appium.

我已经实现了使用Appium在iPhone / iPad模拟器上运行我的测试用例。

With simulators:

capabilities.setCapability("device", "iPhone Simulator");
capabilities.setCapability("app", "Safari");

Now I'm trying to execute some test using the iPhone web browser on a real device so I set the UDID number.

现在我正在尝试使用真实设备上的iPhone Web浏览器执行一些测试,因此我设置了UDID号码。

With real device:

使用真实设备:

capabilities.setCapability("device", "75cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
capabilities.setCapability("app", "Safari");

but, appium needs an absolute path for that app.

但是,appium需要该应用程序的绝对路径。

I'm also trying with Appium GUI and I have same result. I don't known if it's possible to run iPhone apps with Appium on a real devices or not. If it is possible, can anybody tell me which absolute path I need?

我也尝试使用Appium GUI,我也有同样的结果。我不知道是否可以在真实设备上使用Appium运行iPhone应用程序。如果有可能,有人能告诉我我需要哪条绝对路径?

Sorry my english.

对不起我的英文。

Thanks for your time.

谢谢你的时间。

3 个解决方案

#1


5  

The absolute path is a filepath to an application on your Mac that Appium will grab and install before starting the test you are trying to run. Currently the way that people are making this work for getting Mobile Safari open is using an absolute path to a program like SafariLauncher which opens Mobile Safari for you. After that happens you can retrieve the window handle of the webview within Safari and start running normal WebDriver commands.

绝对路径是Mac上应用程序的文件路径,Appium将在您开始尝试运行的测试之前获取并安装该文件路径。目前,人们开始使Mobile Safari开放的方式是使用SafariLauncher等程序的绝对路径,为您打开Mobile Safari。在此之后,您可以在Safari中检索webview的窗口句柄并开始运行正常的WebDriver命令。

This workaround is discussed at length here. I can confirm that it works, but the timing of all these components working together is a bit janky, speaking from my testing experience.

这里将详细讨论此解决方法。我可以确认它是有效的,但是从我的测试经验来看,所有这些组件协同工作的时间有点笨拙。

For reference, I believe these are the capabilities that I used to get myself up and running.

作为参考,我相信这些是我用来启动和运行的功能。

capabilities.setPlatform(Platform.valueOf("MAC"));
capabilities.setBrowserName("iPhone");
capabilities.setCapability("app", "/path/to/SafariLauncher.app");

#2


2  

Yes its possible to run Appium for real devices like IPhone IPad.

是的,可以为iPhone IPad等真实设备运行Appium。

Note:

  1. Appium latest version, ios_webkit_debug_proxy latest and running.
  2. Appium最新版本,ios_webkit_debug_proxy最新并正在运行。

  3. Testing device should be added, in the provisioning profile and use that while building your app in XCODE.
  4. 应该在配置文件中添加测试设备,并在XCODE中构建应用程序时使用它。

Try this: For ios_webkit_debug_proxy command should be

试试这个:对于ios_webkit_debug_proxy命令应该是

"ios_webkit_debug_proxy -c <<deviceID>>:27753 -d"

Appium connect to ios_webkit at this port 27753 for devices.

Appium在此端口27753上连接到ios_webkit以获取设备。

In the APPIUM GUI give:

在APPIUM GUI中给出:

  1. Choose the app location (.app or .ipa) file
  2. 选择应用程序位置(.app或.ipa)文件

  3. Give the UDID of the device you connected
  4. 提供所连接设备的UDID

  5. Mention the bundle ID of the app (as mentioned in the XCODE)
  6. 提及应用程序的软件包ID(如XCODE中所述)

  7. Set the XCODE location setting in the APPIUM Preferences.
  8. 在APPIUM首选项中设置XCODE位置设置。

In Code:

  1. Capabilities only need (BROWSER_NAME, PLATFORM, DEVICE=IPad/IPhone etc)
  2. 功能只需要(BROWSER_NAME,PLATFORM,DEVICE = IPad / IPhone等)

  3. No need to mention app location from code.
  4. 无需从代码中提及应用程序位置。

Start ios_webkit_debug_proxy >> Start APPIUM >> START TEST CASE.

启动ios_webkit_debug_proxy >>启动APPIUM >> START TEST CASE。

#3


0  

  1. First when you are using Real device create provisioning profile and run the app and get its .app file
  2. 首先,当您使用Real设备创建配置文件并运行应用程序并获取其.app文件时

  3. Open the appium application browse the .app file check force device iPhone
  4. 打开appium应用程序浏览.app文件检查强制设备iPhone

  5. Specify the bundle identifier that you gave while creating provisioning profile
  6. 指定在创建配置文件时指定的软件包标识符

  7. Specify the device UDID
  8. 指定设备UDID

  9. Click on launch u can find the appium running your app just click appium inspector you can see the app lauching on real device.
  10. 点击启动你可以找到运行你的应用程序的appium只需点击appium inspector你可以看到应用程序在真实设备上发布。

#1


5  

The absolute path is a filepath to an application on your Mac that Appium will grab and install before starting the test you are trying to run. Currently the way that people are making this work for getting Mobile Safari open is using an absolute path to a program like SafariLauncher which opens Mobile Safari for you. After that happens you can retrieve the window handle of the webview within Safari and start running normal WebDriver commands.

绝对路径是Mac上应用程序的文件路径,Appium将在您开始尝试运行的测试之前获取并安装该文件路径。目前,人们开始使Mobile Safari开放的方式是使用SafariLauncher等程序的绝对路径,为您打开Mobile Safari。在此之后,您可以在Safari中检索webview的窗口句柄并开始运行正常的WebDriver命令。

This workaround is discussed at length here. I can confirm that it works, but the timing of all these components working together is a bit janky, speaking from my testing experience.

这里将详细讨论此解决方法。我可以确认它是有效的,但是从我的测试经验来看,所有这些组件协同工作的时间有点笨拙。

For reference, I believe these are the capabilities that I used to get myself up and running.

作为参考,我相信这些是我用来启动和运行的功能。

capabilities.setPlatform(Platform.valueOf("MAC"));
capabilities.setBrowserName("iPhone");
capabilities.setCapability("app", "/path/to/SafariLauncher.app");

#2


2  

Yes its possible to run Appium for real devices like IPhone IPad.

是的,可以为iPhone IPad等真实设备运行Appium。

Note:

  1. Appium latest version, ios_webkit_debug_proxy latest and running.
  2. Appium最新版本,ios_webkit_debug_proxy最新并正在运行。

  3. Testing device should be added, in the provisioning profile and use that while building your app in XCODE.
  4. 应该在配置文件中添加测试设备,并在XCODE中构建应用程序时使用它。

Try this: For ios_webkit_debug_proxy command should be

试试这个:对于ios_webkit_debug_proxy命令应该是

"ios_webkit_debug_proxy -c <<deviceID>>:27753 -d"

Appium connect to ios_webkit at this port 27753 for devices.

Appium在此端口27753上连接到ios_webkit以获取设备。

In the APPIUM GUI give:

在APPIUM GUI中给出:

  1. Choose the app location (.app or .ipa) file
  2. 选择应用程序位置(.app或.ipa)文件

  3. Give the UDID of the device you connected
  4. 提供所连接设备的UDID

  5. Mention the bundle ID of the app (as mentioned in the XCODE)
  6. 提及应用程序的软件包ID(如XCODE中所述)

  7. Set the XCODE location setting in the APPIUM Preferences.
  8. 在APPIUM首选项中设置XCODE位置设置。

In Code:

  1. Capabilities only need (BROWSER_NAME, PLATFORM, DEVICE=IPad/IPhone etc)
  2. 功能只需要(BROWSER_NAME,PLATFORM,DEVICE = IPad / IPhone等)

  3. No need to mention app location from code.
  4. 无需从代码中提及应用程序位置。

Start ios_webkit_debug_proxy >> Start APPIUM >> START TEST CASE.

启动ios_webkit_debug_proxy >>启动APPIUM >> START TEST CASE。

#3


0  

  1. First when you are using Real device create provisioning profile and run the app and get its .app file
  2. 首先,当您使用Real设备创建配置文件并运行应用程序并获取其.app文件时

  3. Open the appium application browse the .app file check force device iPhone
  4. 打开appium应用程序浏览.app文件检查强制设备iPhone

  5. Specify the bundle identifier that you gave while creating provisioning profile
  6. 指定在创建配置文件时指定的软件包标识符

  7. Specify the device UDID
  8. 指定设备UDID

  9. Click on launch u can find the appium running your app just click appium inspector you can see the app lauching on real device.
  10. 点击启动你可以找到运行你的应用程序的appium只需点击appium inspector你可以看到应用程序在真实设备上发布。