autoLaunch false results in appium exception

I can duplicate this on both iOS and Android devices. I am making a connection with autoLaunch set to false, as I do not want to install nor launch the app. I can make the connection successfully. However, whenever I try to call getPageSource or getScreenShotAs, appium will throw an exception, and my client sits until the request times out.

info: [debug] Pushing command to appium work queue: [“source”,{}]
error: Unhandled error: TypeError: Cannot read property ‘sendAction’ of null
at [object Object]. (appium/lib/devices/android/android.js:502:23)
at Immediate.q.process [as _onImmediate] (appium/node_modules/async/lib/async.js:806:21)
at processImmediate [as _immediateCallback] (timers.js:367:17) context: [GET /wd/hub/session/d605256e-84d0-43e7-8da4-449c077ff575/source {}]

My iOS params are:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.IOS);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “JimiPad”);
capabilities.setCapability(“udid”,“4f76260397efb68572e1f33514e1f38bbff52a06”);
capabilities.setCapability(“bundleId”, “com.apple.mobilesafari”);
capabilities.setCapability(“autoLaunch”, false);
capabilities.setCapability(“noReset”, true);
capabilities.setCapability(“automationName”, “Appium”);
driver = new IOSDriver(new URL(“http://127.0.0.1:4723/wd/hub”), capabilities);

    Exception will happen with this call.
	String src = driver.getPageSource();

And here are the Android desiredcaps:
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
capabilities.setCapability(“udid”,“58d552bc0628b527”);
capabilities.setCapability(MobileCapabilityType.APP_PACKAGE, “info.androidhive.slidingmenu”);
capabilities.setCapability(MobileCapabilityType.APP_ACTIVITY, “info.androidhive.slidingmenu.MainActivity”);
capabilities.setCapability(“autoLaunch”, false);
capabilities.setCapability(“noReset”, true);
capabilities.setCapability(“automationName”, “Appium”);

Is the autoLaunch feature supposed to work or is something missing in the desiredCaps?
Thanks,
Jim

@jim.caldwell
Sorry I Dont have ans but technically I feel this is not a bug because if you are not launching any app or browser in your device then what u expect which page source appium will provide u ???

Let’s consider with autoLaunch false appium just created the connection then instead of page SRC can u try some other command like click any icon on screen or press HOME button of device talking in context of android app…

Cap wise nothing is missing… just thinking that for android we do not have udid cap , we have deviceName cap…

Sorry, It was my bad. I just checked that autolaunch-false-results-in-appium-exception if nothing is launched session handle driver does not interact with any element until we manually start/launch any activity .

You can raise this issue with appium and take there inputs.

Can you share u r testcase what you want do after creating session with autoLaunch=false

I think using an autoLaunch as false, is just a way to defer the launching. You still need to call launchApp at some point before the other calls are reliable. The launchApp is tighly coupled to all the initialization of UIAutomator/instruments that you can’t expect to get any page source without first launching an app first.