简体   繁体   中英

Appium Desktop 1.6.1> IOS> java: running desired capabilities gives bad

Background information

Eclipse: 4.5.2 Appium Desktop: 1.6.1 Java 1.8.0_7 b15

Hi,

I cannot run my desired capabilities from eclipse to appium desktop (IOS).

How do I fix this? My desired Capabilities are correct.

public class InvokeIOS {

public static void main(String[] args) throws MalformedURLException {

// TODO Auto-generated method stub

DesiredCapabilities d=new DesiredCapabilities();

d.setCapability(MobileCapabilityType.DEVICE_NAME,"iPhone 6");

d.setCapability(MobileCapabilityType.PLATFORM_NAME,"IOS");

d.setCapability(MobileCapabilityType.AUTOMATION_NAME,AutomationName.IOS_XCUI_TEST);

d.setCapability(MobileCapabilityType.APP,"/Users/jacquelinegeorge/Documents/Appium/Apps/ios-uicatalog-master/DerivedData/UICatalog/Build/Products/Debug-iphonesimulator/UICatalog.app");

IOSDriver<IOSElement> driver = new IOSDriver<>(new URL("http://127.0.0.1:4723/wd/hub"),d);

I get the following error message

Exception in thread "main" org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Bad app: /Users/jacquelinegeorge/Documents/Appium/Apps/ios-uicatalog-master/DerivedData/UICatalog/Build/Products/Debug-iphonesimulator/UICatalog.app. App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name .

Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:22.379Z'

System info: host: 'Jacquelines-MacBook-Air.local', ip: '192.168.0.5', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.4', java.version: '1.8.0_71'

Driver info: driver.version: IOSDriver

remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Bad app: /Users/jacquelinegeorge/Documents/Appium/Apps/ios-uicatalog-master/DerivedData/UICatalog/Build/Products/Debug-iphonesimulator/UICatalog.app. App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name.

at getResponseForW3CError (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/lib/protocol/errors.js:800:13) at asyncHandler$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/lib/protocol/protocol.js:352:37) at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/node_modules/babel-runtime/regenerator/runtime.js:67:40) at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/node_modules/babel-runtime/regenerator/runtime.js:315:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/node_modules/babel-runtime/regenerator/runtime.js:100:21) at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/node_modules/babel-runtime/regenerator/runtime.js:136:37) at at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57) at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104) at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958) at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) at java.util.stream.AbstractPipeline.c opyInto(AbstractPipeline.java:485) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:138) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:89) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java :1) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142) at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:83) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:93) at io.appium.java_client.ios.IOSDriver.(IOSDriver.java:78) at iostraining.InvokeIOS.main(InvokeIOS.java:22)

The original error states: Bad app: /Users/jacquelinegeorge/Documents/Appium/Apps/ios-uicatalog-master/DerivedData/UICatalog/Build/Products/Debug-iphonesimulator/UICatalog.app. App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name. Bad app: /Users/jacquelinegeorge/Documents/Appium/Apps/ios-uicatalog-master/DerivedData/UICatalog/Build/Products/Debug-iphonesimulator/UICatalog.app. App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name.

Your capabilities look correct, but what you need to do:

  1. Check that the path is correct, try to move to some folder to have shorter absolute path.
  2. Rebuild your application, the build maybe corrupted.
  3. Try with different simulator: sometimes you may get it when you build app with 1 simulator, but trying to use another one via Appium
  4. Try to downgrade appium server

I figured out why I kept getting the bad app message. As mentioned before this was due to the location of .app file (which I copied from XCode). Which I could not move to my desktop, because the .app file was hidden and I could get access to it via Xcode.

However, there is a undercover issues which is connected xcode which contributes the 'bad app message'.

When I initially built the 'UIcatalog app' in xcode it showed a LOT of 'depreciated' messages'. Seeing that I cleaned the build (that is a mistake in THIS instance).

Instead I should have left it alone, ignored the depreciation messages and let the app install itself on the ios simulator.

Here's why:

when you clean the build you it will hide the .app file, its impossible to access the location (right click >show in folder), and you can't make a copy of the .app file that you can place on your desktop for your desired capabilities because its hidden in a secure location.

As you can see by clicking the link below (after I built the UICatalog in Xcode without cleaning the build.

I clicked the folder icon > Then select UICatalog.xprog > then select products I selected UI Catalog .app > R/click , Select 'show in finder' > copy the UI catalog.app file> paste it on to my desktop.

I just found this out yesterday after nearly a month of not being able NO progress with my IOS training.

Click here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM