Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I run an app on a real device (iPhone) from a laptop (mac) with Appium - WebDriver?

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

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.

With real device:

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

but, appium needs an absolute path for that app.

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?

Sorry my english.

Thanks for your time.

like image 679
Héctor Flores Avatar asked Mar 23 '23 11:03

Héctor Flores


2 Answers

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.

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");
like image 157
Christopher Horenstein Avatar answered Apr 21 '23 12:04

Christopher Horenstein


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

Note:

  1. Appium latest version, ios_webkit_debug_proxy latest and running.
  2. Testing device should be added, in the provisioning profile and use that while building your app in XCODE.

Try this: For ios_webkit_debug_proxy command should be

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

Appium connect to ios_webkit at this port 27753 for devices.

In the APPIUM GUI give:

  1. Choose the app location (.app or .ipa) file
  2. Give the UDID of the device you connected
  3. Mention the bundle ID of the app (as mentioned in the XCODE)
  4. Set the XCODE location setting in the APPIUM Preferences.

In Code:

  1. Capabilities only need (BROWSER_NAME, PLATFORM, DEVICE=IPad/IPhone etc)
  2. No need to mention app location from code.

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

like image 24
Jyoti Prakash Avatar answered Apr 21 '23 12:04

Jyoti Prakash