Automate Apple watch

Can this be done the same way it’s done for the iPhone?

1 Like

Have you checked if Apple Watch is supported by UI Automation?

1 Like

I’ve been looking around but information is limited. I just upgraded xcode for the sdk and have the sim working but am unsure if it would work with appium, at least for now. If you run a sim you would identify the device via the name or udid usually but the watch doesn’t appear on the device list.

From what I’ve heard Apple watch is treated as part of the iOS app, it’s another “view” or something like that.

To verify whether appium works with it, you’ll need an apple watch app and then try to use Instruments -> UIAutomation in it.

1 Like

Hey any body has any update on this. Can we automate Apple watch apps using Appium. I could not find on Apple’s site specifically written about using UiAutomation for watch apps. I have to start working on it so I will try using Instruments to automate the watch app and will share my findings soon.

1 Like

Here are few findings. I found in the XCode 6.2 release notes that Instrument is supported for WatchKit so we can very well use Intruments UIAutomation for automating Watch apps.

So I tried to use Appium 1.3.6 version and passed the Watch .app target in the MobileCapabilityType.APP. It successfully launched the watch simulator and also launched the app. But now when I am trying to find the elements using the accessibilityID then it is giving noSuchElementException.

I also tried to use Appium Inspector but it is not at showing the Watch screen in the Inspector Window. It just shows the Black iPhone Window.

I am still trying different things and keep you posted.

2 Likes

Also Appium is launching the watch app in the default scheme. I could not find a way to switch to different scheme.

But using Xcode I am able to launch the Watch app for different schemes and I am passing the same .app binary file for this particular scheme to Appium. Still Appium launches the Watch app in the default scheme.

So I think we need to figure out a way to pass on this information to Appium.

Thank you very much @Amit_Rawat can you please give me the steps since 8 months i am automating the same iOS app now they are integrated to watch kit . what is the setup do i need to launch watchkit app .

Please help me out on this

Thanks,
Rakeshkumar

hello everyone, any updates on automating Apple watch, If we have a app already installed.

Through Xcode 7, was able to create a simple app for apple watch, moved first into the Apple real device Iphone 5s IOS9.1 and then enabled the app into Apple watch.

In the Xcode was able to see the unique identifier for the Apple watch and tried using that in ios_webkit_debug_proxy which will make a connection

ios_webkit_debug_proxy -c xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:27753

but its not connected, please reply if you come across any of this.

Hello Everyone,

I did spend sometime trying to automate real apple watch found some interesting details.
Hope you all know that IOS device automation is implemented through Apple Xcode Instruments

Appium uses the below command to connect your device,

/Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/iosNative3/appium-instruments/instrumentscli0.trace -w <DEVICE_ID> NativeWatchApp.ipa -e UIASCRIPT “/Users/nesag/Library/Application Support/appium/bootstrap/bootstrap-f723d525fd697ec3.js” -e UIARESULTSPATH /tmp/iosNative3/appium-instruments

If you do the below command used to list out all devices including Apple watch

/Applications/Xcode.app/Contents/Developer/usr/bin/instruments -s devices

But the paired real watch device will not be shown in the list of devices, Don’t know is this a problem with Xcode/Apple or some settings missing like *.plist

If your watch is listed using the instruments, with Appium definitely its possible to automate Apple Watch Native App

If you open the instruments in the below path, you will able to see the real apple watch connected before the choose target

/Applications/Xcode.app/Contents/Applications/Instruments

But really don’t why its listing down using the below command
/Applications/Xcode.app/Contents/Developer/usr/bin/instruments -s devices

Its really a Apple/Xcode questions, If anyone know anything about this, please do really me, its really stopping my work doing automation on Real Apple Watch device.

any update on this?

Did some one try this and got any success?

Hello Everyone,

Finally got an answer from Apple about why Apple Watch real device not listing in the Xcode commands.

instruments -s devices

  • Answer from Apple:

Unfortunately, that is a known limitation of the command line instruments tool at this time.

did you try on Simulator? Your question to Apple was for real Device.

PS: i dont have a clue that apple watch simulator is available or not. But just curious.

yes Its for the real device.

Hi, I was trying to automate testing using appium. Target device is iOS watch but failing here.
Desired capabilities which I used are:
DesiredCapabilities capabilitiesiOS = new DesiredCapabilities();
capabilitiesiOS.setCapability(“platformName”, “iOS”);
capabilitiesiOS.setCapability(“platformVersion”, “4.2”);
capabilitiesiOS.setCapability(“deviceName”, “Apple Watch Series 2 - 38mm”);
capabilitiesiOS.setCapability(MobileCapabilityType.BROWSER_NAME, “”);
capabilitiesiOS.setCapability(“noReset”,true);
capabilitiesiOS.setCapability(“automationName”,“XCUITest”);
capabilitiesiOS.setCapability(“autoAcceptAlerts”, true);
capabilitiesiOS.setCapability(“autoGrantPermissions”, true);
capabilitiesiOS.setCapability(“showXcodeLog”,true);
capabilitiesiOS.setCapability(“app”,"/Users/user/Documents/Automation/182/appbuild/apps/ios/workspace/gaut/platforms/ios/Build/Products/Debug-iphonesimulator/WatchApp.app");
capabilitiesiOS.setCapability(“bundleId”, “com.example.watchapp”);

I was able to automate the android watch app. I tried appium desktop version to do so. Whenever I start session for iOS watch it gives me error:
An unknown server-side error occurred while processing the command. Original error: ‘watchOS 4.2’ does not exist in the list of simctl SDKs. Only the following Simulator SDK versions are available on your system: 11.2

Can anyone guide me here how to resolve this defect.

Hi Everyone,
Even with the latest Xcode(10.1) and Watch OS 5 , we cannot automate watch apps. Possibly because, Apple does not provide support to build an app exclusively for Apple watch(there is no target to be set for apple watch in Xcode). It comes as a single bundle for iPhone with watchkit. However using PivotalCoreKit framework there was a possiblity to test watch apps until WatchOS 2.

Please update if anyone is able to automate watch apps.

Hi Every one,
Is any one able to automate apple watch apps on a real apple watch.