5 April 2024 Leave a comment Tech-Help
When setting up automated testing for mobile applications using Appium and WebdriverIO, you may encounter the following error: [HTTP] No route found for /session. This issue can prevent your tests from running as expected, leaving you with a non-responsive emulator and an error message. This guide will walk you through a solution to resolve this issue and get your automated tests up and running.
Understanding the Problem
The issue arises when the Appium server does not recognize the default route for creating a new session. This can occur due to a misconfiguration in the path where the Appium server is expecting to receive requests from WebdriverIO.
Step-by-Step Solution
-
Start the Appium Server with a Specific Base Path:
Use the following command to start the Appium server:
appium --base-path /wd/hub
This command specifies the base path for the Appium server, which allows the server to properly route the incoming sessions from WebdriverIO.
-
Update the WebdriverIO Configuration:
In your
wdio.conf.js
or similar configuration file, ensure you have the following settings:path: '/wd/hub', port: 4723, services: ['appium'],
By setting the path to
/wd/hub
, you are directing WebdriverIO to the correct endpoint that the Appium server is monitoring. -
Additional Considerations for iOS Testing:
If you are testing on an iOS simulator or device with version 15 or above and using Appium version 1.21, you may face compatibility issues, as Appium 1.21 does not support iOS 15. To resolve this, you can install an older version of the iOS simulator that is compatible with your version of Appium.
Conclusion
Following these steps should resolve the No route found for /session error, allowing your WebdriverIO tests to communicate with the Appium server correctly. If you continue to experience issues, double-check your configurations for any typos or omissions and ensure that your Appium server is up-to-date and compatible with your testing platform.