What’s the error –
Most of times, if you have setup ios for appium tests, you might get error “Unable to launch WebDriverAgent because of xcodebuild failure: not found: carthage” while
- Opening the appium inspector from GUI
- Running the appium tests
The above error is due to WebDriverAgent is not installed on your real device or simulator connected to run the appium tests.
The WebDriverAgent is a facebook’s utility app that helps us to run our appium tests and performs action on the ios apps.
We will see all detail steps on how to resolve the error –
Prerequisite –
Make sure you have
xcode installed, if not download from here
apple id created, if not Manage your Apple ID [Create or sign in]
verify carthage should be in /usr/local/bin/carthage
which carthage
if not, then Install carthage
brew install carthage
Note – if brew command not found, then install brew for mac
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Steps to follow
appium documentation which provides the detail of the next steps to perform, so let’s follow the fully manual configuration section
Get the appium installed folder
which appium
Normally you will see the path as /usr/local/bin/appium
We need to find the appium-wedriveragent from below folder – [/usr/local…]
/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent
Note – If you are using appium GUI, then the directory path would be
/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent
Navigate to above directory in terminal & run –
mkdir -p Resources/WebDriverAgent.bundle
./Scripts/bootstrap.sh -d
Note – Run commands from this appium-webdriveragent directory
once it will run,
Open the WebDriverAgent.xcodeproj
in xcode
Click on Project > Target > WebDriverAgentLib
, do the following 2 steps
Step 1
Navigate to Build Settings > Packaging > Product Bundle Identifier
Change to something unique, e.g com.facebook1.[something]
Then, Step 2
Navigate to Signing & Capabilities > Team
Add an account with your apple id & select the apple id, then signing certificate will be updated accordingly
Make sure you check the checkbox “Automatically manage signing “
Now repeat the above 2 steps for the Target > WebDriverAgentRunner
To test if the project build successfull
you can go to xcode > project > Product [from menu toolbar] > Clean build folder > then build
If the build successful, then you are good to go!
Another way to test, run this below command – [test command]
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=<udid>' test
To get the udid of currently connected real device or simulator –
xcrun simctl list
You will see the udid
of any connected device or already launched simulator as (booted)
iPhone 12 mini (D1C228C2-8F7E-4E65-A2FA-E701C9F608BF) (Shutdown) iPhone 12 (29995F00-CA33-4FEE-A6B6-A7BA877B911F) (Booted) ...
You might get below error after running the test command
Testing failed: Building for iOS Simulator, but the linked and embedded framework 'YYCache.framework' was built for iOS + iOS Simulator. Building for iOS Simulator, but the linked and embedded framework 'CocoaAsyncSocket.framework' was built for iOS + iOS Simulator. Building for iOS Simulator, but the embedded framework 'CocoaAsyncSocket.framework' was built for iOS + iOS Simulator. Building for iOS Simulator, but the embedded framework 'YYCache.framework' was built for iOS + iOS Simulator. Testing cancelled because the build failed.
Solution –
You can go to xcode > project > target > Build Setting > Build Options > validate workspace > select “Yes” [for both WebDriverAgentLib & WebDriverAgentRunner ]
After you are done with above steps, do rebuild the project or run the test command
If test successfull, then you will see output as
Running tests... Test Suite 'All tests' started at ...
Hey, thank you for the useful article.
Just a question, I get the same error with exit code 65, but don’t have a certificate, is it possible to install webDriveAgent without it?
Thanks for your comment!
Yes, without certificate you can follow this above steps and get it done!
Not able to see the “Validate Workspace” option in my Xcode 14. Please