2

My set capabilities are

DesiredCapabilities d= new DesiredCapabilities();
d.setCapability(MobileCapabilityType.DEVICE_NAME,"iPhone 8 Plus");
d.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS 12.1");
d.setCapability(MobileCapabilityType.AUTOMATION_NAME,AutomationName.IOS_XCUI_TEST);
d.setCapability(MobileCapabilityType.APP, "⁨/Users/⁨bhabanimishra⁩/Desktop/UICatalog.app");

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

I am getting the below error when trying to access .ipa file in appium:

[info] [Appium] Welcome to Appium v1.9.1
[info] [Appium] Appium REST http interface listener started on 0.0.0.0:4723[info] [HTTP] --> POST /wd/hub/session
[info] [HTTP] {"desiredCapabilities":{"app":"⁨/Users/⁨bhabanimishra⁩/Desktop/UICatalog.app","automationName":"XCuiTest","platformName":"iOS","deviceName":"iPhone 8 Plus"}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"⁨/Users/⁨bhabanimishra⁩/Desktop/UICatalog.app","automationName":"XCuiTest","platformName":"iOS","deviceName":"iPhone 8 Plus"},null,null]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1541757347221 (15:25:47 GMT+0530 (IST))
[info] [Appium] Creating new XCUITestDriver (v2.94.2) session
[info] [Appium] Capabilities:
[info] [Appium]   app: ⁨/Users/⁨bhabanimishra⁩/Desktop/UICatalog.app
[info] [Appium]   automationName: XCuiTest
[info] [Appium]   platformName: iOS
[info] [Appium]   deviceName: iPhone 8 Plus
[debug] [BaseDriver] Creating session with MJSONWP desired capabilities: {"app":"⁨/Users/⁨bhabanimis...
[info] [BaseDriver] Session created with session id: 448234a4-dc13-474d-bc17-a08ada77b861
[debug] [XCUITest] Current user: 'bhabanimishra'[debug] [XCUITest] Xcode version set to '10.1' 
[debug] [XCUITest] iOS SDK Version set to '12.1'
[debug] [BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1541757347549 (15:25:47 GMT+0530 (IST))[info] [XCUITest] Simulator udid not provided, using desired caps to create a new simulator
[info] [XCUITest] No platformVersion specified. Using latest version Xcode supports: '12.1' This may cause problems if a simulator does not exist for this platform version.[debug] [simctl] Creating simulator with name 'appiumTest-iPhone 8 Plus', device type id 'iPhone 8 Plus' and runtime id '12.1'[info] [iOSSim] Constructing iOS simulator for Xcode version 10.1 with udid '0A22BBD7-8861-4DBE-A7E9-100A8B6A6031'
[info] [XCUITest] Created simulator with udid '0A22BBD7-8861-4DBE-A7E9-100A8B6A6031'.
[info] [XCUITest] Determining device to run tests on: udid: '0A22BBD7-8861-4DBE-A7E9-100A8B6A6031', real device: false
[error] [XCUITest] Error: The application at '⁨/Users/⁨bhabanimishra⁩/Desktop/UICatalog.app' does not exist or is not accessible
[error] [XCUITest]     at Object.configureApp$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/helpers.js:97:11)
[error] [XCUITest]     at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[error] [XCUITest]     at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[error] [XCUITest]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[error] [XCUITest]     at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[error] [XCUITest]     at run (/Applications/Appium.app/Contents/Resources/app/webpack:/~/babel-polyfill/~/core-js/modules/es6.promise.js:75:1)
[error] [XCUITest]     at /Applications/Appium.app/Contents/Resources/app/webpack:/~/babel-polyfill/~/core-js/modules/es6.promise.js:92:1
[error] [XCUITest]     at flush (/Applications/Appium.app/Contents/Resources/app/webpack:/~/babel-polyfill/~/core-js/modules/_microtask.js:18:1)
[error] [XCUITest]     at process._tickCallback (internal/process/next_tick.js:61:11)
[error] [XCUITest] Error: Bad app: ⁨/Users/⁨bhabanimishra⁩/Desktop/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.
[error] [XCUITest]     at XCUITestDriver.configureApp$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:652:13)
[error] [XCUITest]     at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[error] [XCUITest]     at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[error] [XCUITest]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[error] [XCUITest]     at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[error] [XCUITest]     at run (/Applications/Appium.app/Contents/Resources/app/webpack:/~/babel-polyfill/~/core-js/modules/es6.promise.js:75:1)
[error] [XCUITest]     at /Applications/Appium.app/Contents/Resources/app/webpack:/~/babel-polyfill/~/core-js/modules/es6.promise.js:92:1
[error] [XCUITest]     at flush (/Applications/Appium.app/Contents/Resources/app/webpack:/~/babel-polyfill/~/core-js/modules/_microtask.js:18:1)
[error] [XCUITest]     at process._tickCallback (internal/process/next_tick.js:61:11)
[debug] [XCUITest] Not clearing log files. Use `clearSystemFiles` capability to turn on.
[debug] [XCUITest] Deleting simulator created for this run (udid: '0A22BBD7-8861-4DBE-A7E9-100A8B6A6031')
[debug] [XCUITest] Killing running processes 'xcodebuild.*0A22BBD7-8861-4DBE-A7E9-100A8B6A6031, 0A22BBD7-8861-4DBE-A7E9-100A8B6A6031.*XCTRunner' for the device 0A22BBD7-8861-4DBE-A7E9-100A8B6A6031...
[debug] [XCUITest] 'pgrep -nif xcodebuild.*0A22BBD7-8861-4DBE-A7E9-100A8B6A6031' didn't detect any matching processes. Return code: 1
[debug] [XCUITest] 'pgrep -nif 0A22BBD7-8861-4DBE-A7E9-100A8B6A6031.*XCTRunner' didn't detect any matching processes. Return code: 1[debug] [BaseDriver] Event 'newSessionStarted' logged at 1541757351769 (15:25:51 GMT+0530 (IST))
[debug] [MJSONWP] Encountered internal error running command: Error: Bad app: ⁨/Users/⁨bhabanimishra⁩/Desktop/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.
[debug] [MJSONWP]     at XCUITestDriver.configureApp$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:652:13)
[debug] [MJSONWP]     at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[debug] [MJSONWP]     at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[debug] [MJSONWP]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[debug] [MJSONWP]     at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[debug] [MJSONWP]     at run (/Applications/Appium.app/Contents/Resources/app/webpack:/~/babel-polyfill/~/core-js/modules/es6.promise.js:75:1)
[debug] [MJSONWP]     at /Applications/Appium.app/Contents/Resources/app/webpack:/~/babel-polyfill/~/core-js/modules/es6.promise.js:92:1
[debug] [MJSONWP]     at flush (/Applications/Appium.app/Contents/Resources/app/webpack:/~/babel-polyfill/~/core-js/modules/_microtask.js:18:1)
[debug] [MJSONWP]     at process._tickCallback (internal/process/next_tick.js:61:11)
[info] [HTTP] <-- POST /wd/hub/session 500 4551 ms - 327
[info] [HTTP]
4

2 回答 2

2

始终使用命令行检查路径:

导航到 .app 文件所在的特定文件夹并运行命令

ls

这应该列出您的 .app 文件,没有运行命令

pwd

它将返回您当前所在的正确路径。将其复制并放入 DesiredCapability

File appDir = new File("/Users/VSBist/Desktop/AppsToTest"); 

        /*IOS DEPENDENCIES START */
        File newApp = new File (appDir ,"YourApp.app");
        cap.setCapability(CapabilityType.BROWSER_NAME, "");
        cap.setCapability("deviceName", "iPhone 6");
        cap.setCapability("platformName", "iOS");
        cap.setCapability("automationName", "XCUItest");
        cap.setCapability("platformVersion","12.0");
        cap.setCapability("connectHardwareKeyboard", false);
        /*IOS DEPENDENCIES ENDS */
于 2019-02-02T15:53:45.393 回答
0

我使用了驱动程序等待功能,它解决了问题

    URL url = new URL ("http://127.0.0.1:4723/wd/hub");
    Driver = new AppiumDriver<MobileElement>(url,DC);
    wait = new WebDriverWait(Driver, 10);
    System.out.println("Calculator Started::");

是的,您可以在 AppiumDriver 测试中等待 WebDriver。

于 2019-12-04T07:54:35.520 回答