failed to install the webdriveragent

Hi! I’m trying to install webdriveragent under setup ios environment but received this error: (hopefully anyone can help me, bcs I’m really a beginner thanks!)

reason: cannot read the array length because “array” is null

java.lang.NullPointerException: Cannot read the array length because “array” is null
at com.kms.katalon.composer.mobile.util.MobileUtil.readProvisioningProfileContents(MobileUtil.java:128)
at com.kms.katalon.composer.mobile.dialog.IosProvisioningProfileAndIdentitySelectionDialog.setInput(IosProvisioningProfileAndIdentitySelectionDialog.java:172)
at com.kms.katalon.composer.components.impl.dialogs.AbstractDialog.create(AbstractDialog.java:58)
at org.eclipse.jface.window.Window.open(Window.java:788)
at com.kms.katalon.composer.mobile.execution.handler.IosInstallWebDriverAgent.setUpRealDevice(IosInstallWebDriverAgent.java:372)
at com.kms.katalon.composer.mobile.execution.handler.IosInstallWebDriverAgent.installWebDriverAgent(IosInstallWebDriverAgent.java:245)
at com.kms.katalon.composer.mobile.execution.handler.IosInstallWebDriverAgent.execute(IosInstallWebDriverAgent.java:109)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:317)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:251)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:485)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:438)
at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:449)
at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.lambda$2(AbstractContributionItem.java:475)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4646)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1547)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1532)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1325)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4413)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3989)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
at com.kms.katalon.core.application.WorkbenchApplicationStarter.start(WorkbenchApplicationStarter.java:23)
at com.kms.katalon.application.Application.runGUI(Application.java:209)
at com.kms.katalon.application.Application.start(Application.java:114)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
at org.eclipse.equinox.launcher.Main.run(Main.java:1467)

1 Like

Hi @hzulaikha,

Welcome to our community. Other people also face the issues like you.
Can I ask for KS version you are using, the OS version, you are using real iOS or simulator? Have you ever installed Webdriveragent successfully? You can read more about the guide on installing WebDriverAgent here. Thank you

To resolve the “failed to install WebDriverAgent” error in Katalon Studio for iOS real device testing, follow these steps:

1. Ensure Proper Provisioning Profile Setup

Fix Provisioning Profile Issues

  • Create a Valid iOS Development Provisioning Profile:
    1. Open Xcode > Preferences > Accounts and ensure your Apple Developer account is added.
    2. For WebDriverAgent, create a provisioning profile with:
    • Bundle ID: com.facebook.WebDriverAgentRunner
    • Capabilities: App Groups, Background Modes (Remote notifications).
    1. Download the profile and install it (double-click the .mobileprovision file).
  • Manual Code Signing in Xcode:
# Navigate to WebDriverAgent project in Xcode
cd /Applications/Katalon\ Studio.app/Contents/Eclipse/plugins/com.kms.katalon.selenium-mobile-app.driver.ios_*.jar/WebDriverAgent
open -a Xcode WebDriverAgent.xcodeproj
  1. Under Signing & Capabilities:
    * Uncheck “Automatically manage signing.”
    * Select your team and provisioning profile manually.

2. Verify Device UDID in Provisioning Profile

  • Ensure the test device’s UDID is included in the provisioning profile:
    1. Retrieve the device UDID via Xcode (Window > Devices and Simulators).
    2. Add the UDID to your Apple Developer account under Certificates, Identifiers & Profiles > Devices.
    3. Re-generate the provisioning profile and reinstall it.

3. Install Xcode Command-Line Tools

xcode-select --install
sudo xcodebuild -license accept

4. Clean DerivedData and Rebuild

Delete cached build files and rebuild WebDriverAgent:

rm -rf ~/Library/Developer/Xcode/DerivedData/WebDriverAgent-*
cd /Applications/Katalon\ Studio.app/Contents/Eclipse/plugins/com.kms.katalon.selenium-mobile-app.driver.ios_*.jar/WebDriverAgent
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=YOUR_DEVICE_UDID' test

5. Manual WebDriverAgent Installation

If automated setup fails:

  1. Clone the Appium WebDriverAgent repository:
git clone https://github.com/appium/WebDriverAgent.git
  1. Configure bundleId and profiles in Xcode as in Step 1.
  2. Point Katalon to the local WebDriverAgent path:
Mobile.startApplication('path/to/app', [
   'bundleId': 'com.your.app',
   'webDriverAgentUrl': 'http://localhost:8100',
   'updatedWDABundleId': 'com.facebook.WebDriverAgentRunner'
])

6. Update Katalon Studio and Dependencies

  • Katalon Studio: Upgrade to the latest version.
  • Xcode: Ensure you’re using Xcode 14+ and iOS 16+.

7. Check for Port Conflicts

Ensure port 8100 is free:

lsof -i :8100
kill -9 <PID>  # Replace <PID> with the process ID

Troubleshooting Notes

  • Error Cause: The NullPointerException (array is null) arises when Katalon fails to read the provisioning profile due to invalid/missing profiles or incorrect code signing.
  • Logs: Check detailed logs at ~/Katalon Studio 配置/logs/catalina.out.
  • Simulator Workaround: Test on an iOS simulator first to isolate device-specific issues.

By addressing provisioning profile setup, code signing, and dependency compatibility, WebDriverAgent should install successfully.