Appium Master iOS10 (Xcode 8) Discussion

Hi all,

Since the release of Xcode 8 Im sure theres a few of us in the same boat, investigating the new webDriverAgent and XCUITest Driver.

At the moment the forums are a bit lacking in resource which is understandable since this is still in beta, but maybe it’s worth sharing our findings to assist the community in the transition.

I myself have found a couple of issues such as the simulator not launching the application once the webDriverAgent is running. (Still investigating)

How has the transition been for everyone else anything useful people want to share?

I will update my own findings in due course.

Thanks

Update 19/12/2016:

I said I would update everyone on my migration once I had time so here it is!

Sytem information:
OS: Version macOS Sierra version 10.12 (16A323)
Xcode: Version Version 8.0 (8A218a) - I Will be using a dummy application for testing.
Appium: Version v1.6.3 (REV fe0f474b95b42ba670800e3877c5c4ef01beb902) - I Will be targeting simulators initially.

Steps undertaken:

1.Read the migration document it helps!

2.Installed the external dependancies per

3.Installed Appium 1.6.3 via npm

4.Test that appium run’s with no errors with no capabilities provided

  • cd /Volumes/Macintosh HD/Users/XXXXX/node_modules
  • node .

5.Created a test script to launch appium with the correct parameters for the test application.

  • StartAppium.sh

contents:

cd "/Volumes/Macintosh HD/Users/XXXXX/node_modules/appium"
node .  -a xxx.xxx.xxx.xxx -p 4723 --command-timeout "900" --session-override --debug-log-spacing --platform-version "10.0" --platform-name "iOS" --app "com.xxx.xxx" --no-reset --device-name "AppiumTestDevice-10" --automation-name XCUITest

a. Launched the script to ensure that no errors where present in the startup of the appium instance.

  1. We use a in house C# framework that we maintain for iOS & Android, so I updated the settings to point to the server and test application. We also pass the capabilities via the framework, so I can remove some of the capabilities from the startup script if I like, usually I have kept these incase I want to use the Appium inspector, but we also have our own inspector.

a. Initially this failed due to having two versions of Xcode installed, core simulator detected Xcode 7.3 not Xcode 8.

Error: simctl error running ‘list’: 2016-12-13 13:42:20.600 simctl[56474:4769997] CoreSimulator is attempting to unload a stale CoreSimulatorService job. Detected Xcode.app relocation or CoreSimulatorService version change. Framework path (/Applications/Xcode-7.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework) and version (209.19)

b. To resolve this issue I set the primary Xcode version

  • xcode-select --switch /path/to/Xcode.app
  • e.g. sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

This resolved the issue with the wrong Xcode been selected.

c. However my simulator then went into overdrive as it was confused with the multiple instances of Xcode (7.3.1 / 8), restarting the mac resolved the issues and I was able to launch the test application with our in house inspector.


Facebook WebDriverAgent Inspector:

If you don’t have your own inspector don’t worry the Facebook WebDriverAgent has one inbuilt but requires you to compile it from source.

When you launch your application you should see the web driver agent starting in the logs, e.g. web driver agent starting on /localhost:8100…

To launch the inspector go to http://localhost:8100/inspector, in my case I received an error due to ‘value: "Invalid parameter not satisfying: path******’

To fix this issue you have to build the WebDriverAgent yourself, special thanks to

Imparticularly follow

cd ~/"${REPOS}"
git clone https://github.com/facebook/WebDriverAgent.git
cd WebDriverAgent
./Scripts/bootstrap.sh
cd "${APPIUM}"
rm -rf WebDriverAgent
ln ~/"${REPOS}"/WebDriverAgent .

To break this down, get the latest driver from github, build and replace your existing WebDriverAgent with the new.

After this I was able to browse to http://localhost:8100/inspector without the crash.


At this point Im able to launch the test application and inspect to see the differences, it’s too early to make comment on what need’s to be changed for the automated test’s to run smoothly, but the migration document above mentions some.

Will keep everyone posted.

4 Likes

Update 1: New issue logged @https://github.com/appium/appium-xcuitest-driver/issues/150

Currently the Json to Xml conversion is not working as expected see above link for full details.

The issue with the simulator not launching the application also resolved itself after reseting the simulator and it’s contents.

I’ve been trying to get it running on real device for about 3 days now at this stage. have Appium 1.6Beta, xcode 8 GM and devices with ios 9.3.2 and 10.0, and it gets as far as putting the WebDriverAgentRunner onto the devices and then sits there waiting for them to start :
[XCUITest] Waiting fo WebDriverAgent to start on device
but it never does.

If I execute the command which it prints out just prior ( xcodebuild -project … -scheme WebDriverAgentRunner - sdk iphoneos -destination… test) from a command line, it works fine, and I see the lines

ServerURLHere->http://…<-ServerURLHere
Listening on USB

as expected, yet never when run from appium…

Any ideas?
Thanks in advance
Ken

Hi Ken,

How are you initialising the application? I have yet to test on a real device but thats next on the list so I will let you know what happens.

I use a C# Mobile Framework which we have written in-house to support our mobile development and test automation, this hasn’t had an issue with the simulator (As far as launching the application) but if you take a look at https://github.com/appium/appium-xcuitest-driver there are some external dependencies for getting things running on a real device.

Let me know how you get on and I will do the same in due course.

Thanks

Hi Christopher,
yeah i’ve got those dependencies all installed, as I said I can see the WebDriverAgent being loaded to the device, it starts up and then goes into the background.
I’m using the python client, which works fine with the same appium version etc using android, but it’s just the ios using xcuitest driver which seems to be getting stuck, and I can’t figure out why.
Ken

Just a thought, the parameters been sent when you launch the application is the bundle identifier correct?

I’m not sure it’s even getting far enough for that to be a problem; appium is never seeing the ‘ServerURLHere’ line to indicate that webdriveragent has started, but when i run the same (I assume - I copy it from the output of appium) command directly from the command line, I do see it in the log.

I’ll try copy the 2 log scenarios here in a short while

Thanks Ken, if you can include an example Python script I can also follow along with my application to see if the results are the same.

May not get a chance until after the weekend is over.

gist here:


3 logs in that, first one is the xcodebuild log output , 2nd is the output from the console of appium and 3rd is when i run the same command from the commad line and it appears to get into the state that appium is waiting for

pythonwise it’s very simple:

from appium import webdriver
caps = {‘deviceName’: “iPad”, ‘udid’: ‘123456789123456789123456789123…’, ‘app’: ‘/Users/User/ios10_testing/iPadDemo/build/Debug-iphoneos/iPadDemo.app’, ‘platformVersion’: ‘9.3.2’, ‘platformName’: ‘iOS’, ‘automationName’: ‘xcuitest’}
driver = webdriver.Remote(“http://0.0.0.0:4723/wd/hub”, caps)

eventually will come back with a stackdump ending with exception:
httplib.BadStatusLine: ‘’

it’s the same for ios10 device too,
Ken

I managed to get it working. I wasn’t specifying the realDeviceLogger capability
only took a week!

Ha brilliant don’t think I would have caught that one I use different capabilitys in my framework.

I have successfully launched iphone simulator with the following code in eclipse with appium server using ios10 update with Xcode8 using XCUITest.

public class LoginTest {

public static void main(String[] args) throws MalformedURLException {
// TODO Auto-generated method stub

DesiredCapabilities cap=new DesiredCapabilities();

File f= new File("/Users/devendra/Desktop/Appium/PogoiOS.app");
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, “iOS”);
cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, “10.0”);
cap.setCapability(MobileCapabilityType.DEVICE_NAME, “iPhone 6”);
cap.setCapability(MobileCapabilityType.AUTOMATION_NAME,“XCUITest”);
cap.setCapability(MobileCapabilityType.BROWSER_NAME, “”);
cap.setCapability(MobileCapabilityType.APP,f.getAbsolutePath());

IOSDriver driver = new IOSDriver(new URL(“http://127.0.0.1:4723/wd/hub”),cap);
//driver.manage().timeouts().implicitlyWait(600, TimeUnit.SECONDS);

}

}

Hi Madhuri…

Thanks for sharing.
Continuing further, are you able to get control of the elements on your app screen? Like, click, tap, sendkey, setvale events…
Also, apart from, driver.getPAgeSource(), are you able to use any other inspection means?

Keep posting!

Hi,

To get control of the elements on your app screen ,

UIATextField[1] is now XCUIElementTypeTextField[1]. But I need to explore more for the same as I am also on the way to automate with ios 10 & xcode 8 :slight_smile:

:+1:
Good luck, keep posting. We really need to keep this thread updated to ensure smooth transition to xcode 8.

I know it’s been some time since the initial post, but I will most likley be taking the jump this week to uplift appium and my project. I have been keeping an eye on the github commit’s and believe it’s time!

If anyone has any tip’s or warnings please let me know!

1 Like

Please help me out
In my case it is getting stuck on
[debug] [XCUITest] Waiting for WebDriverAgent server to finish loading…
[debug] [XCUITest] Waiting for WebDriverAgent server to finish loading…

Even i added realDeviceLogger capability.

Environment

  1. iPad: 10.1
  2. Appium 1.6.2
  3. Xcode: 8.1

Please help me out of this

@ssj87 Is this on simulator or real device and can you copy in your capabilities?

Check the bundle identifier is correct in the launch parameters, if it’s incorrect appium will apear to hang.

Thanks for this Chris, its really useful!