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 –
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
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
Normally you will see the path as /usr/local/bin/appium
We need to find the appium-wedriveragent from below folder – [/usr/local…]
Note – If you are using appium GUI, then the directory path would be
Navigate to above directory in terminal & run –
mkdir -p Resources/WebDriverAgent.bundle
Note – Run commands from this appium-webdriveragent directory
once it will run,
Click on Project >
Target > WebDriverAgentLib, do the following 2 steps
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.
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 ...