2 Real Devices - 2 Different Results - WebDriverAgent Build Test

I’m trying to setup WebDriverAgent before starting any kind of development in Appium.

This is my setup:
El Capitan 10.11.6
XCODE 8.2.1
Appium 1.6.3 installed through sudo nam install -g appium

and then I did all this.
brew install libimobiledevice --HEAD
brew install carthage
npm install -g ios-deploy
gem install xcpretty
npm install appium-doctor -g
npm install appium-xcuitest-driver

Then I did this.
cd /usr/local/lib/node_modules/appium-xcuitest-driver/WebDriverAgent
mkdir -p Resources/WebDriverAgent.bundle
sh ./Scripts/bootstrap.sh -d

Then I signed WebDriverAgentLib and WebDriverAgentRunner. No errors. Except this build time issues.

“The file “ProjectSettings.xcconfig” couldn’t be opened because there is no such file. (/usr/local/lib/node_modules/appium-xcuitest-driver/WebDriverAgent/Configurations/ProjectSettings.xcconfig)”

Now I ran the following command on 2 real devices. 1 on iPhone 6 Plus and an iPad.

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ‘id=cd82456f42112bf4b417613ed3734k5j45k947a8b4a’ test

iPad is stuck at this

ODEV1s-MacBook-Pro:WebDriverAgent odev1$ xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ‘id=909894401609eca3794kj2452l5k24f2ce2c8d1’ test
2017-01-17 13:15:09.148 xcodebuild[5112:27023] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/Users/odev1/Library/Developer/Xcode/DerivedData/WebDriverAgent-gvltwgknevnwclanwpylmjozekma/Logs/Test/56DEBBD1-2134-4805-9A83-2932C891BB27/Session-WebDriverAgentRunner-2017-01-17_131509-Qfhlb7.log
2017-01-17 13:15:09.148 xcodebuild[5112:26980] [MT] IDETestOperationsObserverDebug: (997531EE-A4FD-45E9-9001-73E355B5F59B) Beginning test session WebDriverAgentRunner-997531EE-A4FD-45E9-9001-73E355B5F59B at 2017-01-17 13:15:09.147 with Xcode 8C1002 on target <DVTiOSDevice: 0x7fb64cb32660> {
deviceSerialNumber: DMQN1EVCFK10
identifier: 909894401609eca37940845m4l5k24f2ce2c8d1
deviceClass: iPad
deviceName: iPad
deviceIdentifier: 909894401609eca379404545224f2ce2c8d1
productVersion: 10.1.1
buildVersion: 14B100
deviceSoftwareVersion: 10.1.1 (14B100)
deviceArchitecture: arm64
deviceTotalCapacity: 12265533440
deviceAvailableCapacity: 9163575296
deviceIsTransient: NO
ignored: NO
deviceIsBusy: NO
deviceIsActivated: YES
deviceActivationState: Activated
deviceType: <DVTDeviceType:0x7fb649e03220 Xcode.DeviceType.iPhone>
supportedDeviceFamilies: (
1,
2
)
applications: (null)
provisioningProfiles: (null)
activityProgress: -2
activityTitle:
hasInternalSupport: NO
isSupportedOS: YES
developerDiskMountError: (null)
(null)
} (10.1.1 (14B100))
=== BUILD TARGET WebDriverAgentLib OF PROJECT WebDriverAgent WITH CONFIGURATION Debug ===

Check dependencies
The file “ProjectSettings.xcconfig” couldn’t be opened because there is no such file. (/usr/local/lib/node_modules/appium-xcuitest-driver/WebDriverAgent/Configurations/ProjectSettings.xcconfig)

=== BUILD TARGET WebDriverAgentRunner OF PROJECT WebDriverAgent WITH CONFIGURATION Debug ===

Check dependencies
The file “ProjectSettings.xcconfig” couldn’t be opened because there is no such file. (/usr/local/lib/node_modules/appium-xcuitest-driver/WebDriverAgent/Configurations/ProjectSettings.xcconfig)

MDMCreateDeltaDirectory:1920 calling MDMDirectoryDiff with:
state->old_bundle: /var/folders/py/plwdfs0s247d2sbkzx65kr640000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/b660174c1c1c834b3f6a5d1e14807f03/909894401609eca379408aeac8db224f2ce2c8d1/WebDriverAgentRunner-Runner.app
state->new_bundle: /Users/usjaxfsodev1/Library/Developer/Xcode/DerivedData/WebDriverAgent-gvltwgknevnwclanwpylmjozekma/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app
state->dst_bundle: /var/folders/py/plwdfs0s247d2sbkzx65kr640000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.QJIMrA/WebDriverAgentRunner-Runner.app_sparse.ipa/Payload//WebDriverAgentRunner-Runner.app, binaryDiff flag: FALSE
dst_ipa: /var/folders/py/plwdfs0s247d2sbkzx65kr640000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.QJIMrA/WebDriverAgentRunner-Runner.app_sparse.ipa
__MDMDirectoryDiff_block_invoke.37:1473 calling writeDictToFile with: /var/folders/py/plwdfs0s247d2sbkzx65kr640000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.QJIMrA/WebDriverAgentRunner-Runner.app_sparse.ipa/ManifestCache.plist
writeDictToFile:1278 ==== Successfully wrote Manifest cache to /var/folders/py/plwdfs0s247d2sbkzx65kr640000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.QJIMrA/WebDriverAgentRunner-Runner.app_sparse.ipa/ManifestCache.plist
Test Suite ‘All tests’ started at 2017-01-17 13:15:16.877
Test Suite ‘WebDriverAgentRunner.xctest’ started at 2017-01-17 13:15:16.881
Test Suite ‘UITestingUITests’ started at 2017-01-17 13:15:16.882
Test Case ‘-[UITestingUITests testRunner]’ started.
t = 0.00s Start Test at 2017-01-17 13:15:16.888
t = 0.01s Set Up

It is just stuck here. Nothing happened. I waited for 2 hours.

**

iPhone 6 Plus:

**

ODEV1s-MacBook-Pro:WebDriverAgent usjaxfsodev1$ xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ‘id=cd82456f42112bf4b417613245lk42j5bc7947a8b4a’ test
2017-01-17 14:16:05.809 xcodebuild[5218:39260] [MT] IDETestOperationsObserverDebug: (6341ED4E-557A-49E7-9989-D79EDD0D6745) Beginning test session WebDriverAgentRunner-6341ED4E-557A-49E7-9989-D79EDD0D6745 at 2017-01-17 14:16:05.808 with Xcode 8C1002 on target <DVTiOSDevice: 0x7fa66d900b50> {
deviceSerialNumber: F2LNKFPZG5QF
identifier: cd82456f42112bf4b41761345n34lk7947a8b4a
deviceClass: iPhone
deviceName: Phone with Touchscreen
deviceIdentifier: cd82456f42112bf4b417613ed3702bc7947a8b4a
productVersion: 10.0.2
buildVersion: 14A456
deviceSoftwareVersion: 10.0.2 (14A456)
deviceArchitecture: arm64
deviceTotalCapacity: 11945771008
deviceAvailableCapacity: 60297216
deviceIsTransient: NO
ignored: NO
deviceIsBusy: NO
deviceIsActivated: YES
deviceActivationState: Activated
deviceType: <DVTDeviceType:0x7fa66d5b09a0 Xcode.DeviceType.iPhone>
supportedDeviceFamilies: (
1
)
applications: (null)
provisioningProfiles: (null)
activityProgress: -2
activityTitle:
hasInternalSupport: NO
isSupportedOS: YES
developerDiskMountError: (null)
(null)
} (10.0.2 (14A456))
2017-01-17 14:16:05.809 xcodebuild[5218:39275] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/Users/usjaxfsodev1/Library/Developer/Xcode/DerivedData/WebDriverAgent-gvltwgknevnwclanwpylmjozekma/Logs/Test/AB4B9CE4-015E-4CCB-AFB5-CA3DAB227A55/Session-WebDriverAgentRunner-2017-01-17_141605-eqVW4z.log
=== BUILD TARGET WebDriverAgentLib OF PROJECT WebDriverAgent WITH CONFIGURATION Debug ===

Check dependencies
The file “ProjectSettings.xcconfig” couldn’t be opened because there is no such file. (/usr/local/lib/node_modules/appium-xcuitest-driver/WebDriverAgent/Configurations/ProjectSettings.xcconfig)

=== BUILD TARGET WebDriverAgentRunner OF PROJECT WebDriverAgent WITH CONFIGURATION Debug ===

Check dependencies
The file “ProjectSettings.xcconfig” couldn’t be opened because there is no such file. (/usr/local/lib/node_modules/appium-xcuitest-driver/WebDriverAgent/Configurations/ProjectSettings.xcconfig)

MDMCreateDeltaDirectory:1920 calling MDMDirectoryDiff with:
state->old_bundle: /var/folders/py/plwdfs0s247d2sbkzx65kr640000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/b660174c1c1c834b3f6a5d1e14807f03/cd82456f42112bf4b417613ed3702bc7947a8b4a/WebDriverAgentRunner-Runner.app
state->new_bundle: /Users/usjaxfsodev1/Library/Developer/Xcode/DerivedData/WebDriverAgent-gvltwgknevnwclanwpylmjozekma/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app
state->dst_bundle: /var/folders/py/plwdfs0s247d2sbkzx65kr640000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.7D55gL/WebDriverAgentRunner-Runner.app_sparse.ipa/Payload//WebDriverAgentRunner-Runner.app, binaryDiff flag: FALSE
dst_ipa: /var/folders/py/plwdfs0s247d2sbkzx65kr640000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.7D55gL/WebDriverAgentRunner-Runner.app_sparse.ipa
__MDMDirectoryDiff_block_invoke.37:1473 calling writeDictToFile with: /var/folders/py/plwdfs0s247d2sbkzx65kr640000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.7D55gL/WebDriverAgentRunner-Runner.app_sparse.ipa/ManifestCache.plist
writeDictToFile:1278 ==== Successfully wrote Manifest cache to /var/folders/py/plwdfs0s247d2sbkzx65kr640000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.7D55gL/WebDriverAgentRunner-Runner.app_sparse.ipa/ManifestCache.plist
2017-01-17 14:16:46.075141 XCTRunner[4840:223941] Running tests…
2017-01-17 14:16:47.100810 XCTRunner[4840:223941] Continuing to run tests in the background with task ID 1
Test Suite ‘All tests’ started at 2017-01-17 14:16:47.745
Test Suite ‘WebDriverAgentRunner.xctest’ started at 2017-01-17 14:16:47.748
Test Suite ‘UITestingUITests’ started at 2017-01-17 14:16:47.749
Test Case ‘-[UITestingUITests testRunner]’ started.
t = 0.00s Start Test at 2017-01-17 14:16:47.754
t = 0.01s Set Up
2017-01-17 14:16:47.763680 XCTRunner[4840:224024] [User Defaults] Failed to write value for key AutomationDisableFauxCollectionCells in CFPrefsPlistSource<0x1740e7200> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null)): setting preferences outside an application’s container requires user-preference-write or file-write-data sandbox access, switching to read-only
2017-01-17 14:16:47.769460 XCTRunner[4840:223941] Built at Jan 17 2017 11:48:31
2017-01-17 14:16:47.804932 XCTRunner[4840:223941] ServerURLHere->http://10.243.209.155:8100<-ServerURLHere
2017-01-17 14:16:47.806683 XCTRunner[4840:223941] Listening on USB
error in __connection_block_invoke_2: Connection interrupted

Now I know the outcome of this command should be “Listening on USB” but I get an error in connection line after that. Also the app is installed on the device but I see only a black screen. It launches and closes immediately while all this happens.

Any help to point me in any direction would be appreciated.
Thanks in Advance.

I went here and grabbed the Configurations folder which contains the WebDriverAgent ProjectSettings.xcconfig folder: https://github.com/facebook/WebDriverAgent

I then copied it into my WebDriverAgent folder and rebuilt WebDriverAgent.xcodeproj for WebDriverAgentLib, WebDriverAgentRunner and IntegrationApp.

I still can’t get things working properly on real devices, but this worked for me as far as addressing the ““ProjectSettings.xcconfig” couldn’t be opened because there is no such file.” issue.

I tried that and it worked. I replaced the WebDriverAgent folder I had with the one from https://github.com/facebook/WebDriverAgent

It worked! I don’t see the errors anymore and I’m seeing “Listening on USB” message when I try the build test on my 10.0.2 Device. It does not work on any device above 10.1 and its still stuck at
t = 0.01s Set Up on devices above 10.1

Now I tried running one of the scripts that I have.
Here is the script.

import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.AppiumDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
import org.openqa.selenium.By;

public class ios10 {
public static void main(String[] args) {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“appium-version”, “1.6.3”);
//capabilities.setCapability(“xcodeConfigfile”, “/usr/local/lib/node_modules/appium-xcuitest-driver/WebDriverAgent/Config.xcconfig”);
//capabilities.setCapability(“bundleId”,“ADC.TestiOSDevice”);
capabilities.setCapability(“automationName”, “XCUITest”);
capabilities.setCapability(“platformName”, “iOS”);
capabilities.setCapability(“platformVersion”, “10.0”);
capabilities.setCapability(“deviceName”, “Phone with Touchscreen”);
capabilities.setCapability(“UDID”, “cd82456f42112bf4b417613ed3702bc7947a8b4a”);
//capabilities.setCapability(“app”, “/Users/usjaxfsodev1/Desktop/Test Apps/TestiOSDevice IOS100.app”);
capabilities.setCapability(“app”, “/Users/usjaxfsodev1/Desktop/Test Apps/TestiOSDevice IOS100.app”);
AppiumDriver wd;
try {
wd = new IOSDriver(new URL(“http://127.0.0.1:4723/wd/hub”), capabilities);
wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
wd.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIASwitch[1]")).click();
String lblValue=wd.findElement(By.name(“Mobile Automation - Sup?!”)).getAttribute(“value”);
System.out.print(lblValue);
wd.close();
} catch (MalformedURLException e) {
e.printStackTrace();
}

}

}

I’ve started appium with the UDID like this
appium -U cd82456f42112bf4b417613ed37243k5j2bc7947a8b4a

and when I run the java code above I get the following error.

Exception in thread “main” org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Command ‘/bin/bash Scripts/bootstrap.sh -d’ exited with code 1 (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 8.11 seconds

and I’m stuck again.

Wow, you got the “Listening on USB message”? That’s great! I have yet to see it.

When you replaced the WebDriverAgent folder, did you run…
mkdir -p Resources/WebDriverAgent.bundle
/bin/bash Scripts/bootstrap.sh -d

…in the new WebDriverAgent folder in order to fetch the dependencies?

Yes. I ran those after copying the folder.
I got it running on one device but I have no idea why its stuck at setup…:expressionless:

Also, can anyone help me with the java code to just get the app deployed in the device? I’m new to selenium and appium and I’m kind of stuck.

My current code is

import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.AppiumDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
import org.openqa.selenium.By;

public class ios10 {
public static void main(String[] args) {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“appium-version”, “1.6.3”);
//capabilities.setCapability(“xcodeConfigfile”, “/usr/local/lib/node_modules/appium-xcuitest-driver/WebDriverAgent/Config.xcconfig”);
//capabilities.setCapability(“bundleId”,“ADC.TestiOSDevice”);
capabilities.setCapability(“automationName”, “XCUITest”);
capabilities.setCapability(“platformName”, “iOS”);
capabilities.setCapability(“platformVersion”, “10.0”);
capabilities.setCapability(“deviceName”, “Phone with Touchscreen”);
capabilities.setCapability(“UDID”, “cd82456f42112bh34b5kj456lc7947a8b4a”);
//capabilities.setCapability(“app”, “/Users/odev1/Desktop/Test Apps/TestiOSDevice IOS100.app”);
capabilities.setCapability(“app”, “/Users/odev1/Desktop/Test Apps/TestiOSDevice IOS100.app”);
AppiumDriver wd;
try {
wd = new IOSDriver(new URL(“http://127.0.0.1:4723/wd/hub”), capabilities);
wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
wd.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIASwitch[1]")).click();
String lblValue=wd.findElement(By.name(“Mobile Automation - Sup?!”)).getAttribute(“value”);
System.out.print(lblValue);
wd.close();
} catch (MalformedURLException e) {
e.printStackTrace();
}

}
}

With the above code, are you trying to deploy to a real device? If so, you’ll want to point to an .ipa file for the app. You can run .app files on the simulator, provided that they are configured correctly.