问题
I am writing an automation script using Java + TestNG + Appium.
In a test scenario, I am trying to launch already installed application on iphone. (Box in this case). Box contains some MS office file which I need to access. I am not very sure how can I achieve this.
I tried multiple options such as extracting .app file from iTunes and deploying using Appium, but no success.
Can someone please guide me, if this is possible. If yes, how?
回答1:
Automate a preinstalled app with following scenario.
1.This will only work for applications that are signed with a DEVELOPMENT cert.
2.This will NOT work for applications that are signed with a DISTRIBUTION cert
3.If you have created the app with a developer provisioning profile, and built yourself. Or downloaded it using testFlight, and is signed with a development provisioning profile
4.This is because Apple's Instruments will not allow you to interact with those applications which is live. (Even if you knew the bundleId)
if your app is in development mode please follow these things 1.The bundleId of the app that was installed on the device. Use that as the app capability.
- Follow the Appium Real Devices guide (substitute any
.ipa
/.app
reference with the bundleId)
In addition to your regular desiredCapabilities
(ex. platformName
, platformVersion
, deviceName
).. these should be your desiredCapabilities
:
For preinstalled apps
desiredCaps['app'] = 'yourbindleID'
Device's unique identifier
desiredCaps['udid'] = '1824y983h2849gh2498'
回答2:
this works for me
HashmMap<String, Object> args = new HashMap<String,Object>();
args.put("bundleId","*YOUR_APP_BUNDLEID*");
driver.executeScript("mobile: launchApp", args);
来源:https://stackoverflow.com/questions/39608711/how-to-launch-already-installed-app-from-iphone-using-appium