5 April 2024 Leave a comment Tech-Help
Connecting your Android smartphone to the Appium server and inspector can sometimes be a challenge, especially for those new to mobile application testing. If you’re experiencing difficulties getting Appium to recognize your device, even though it’s properly connected to your Windows machine, this guide will help you resolve common connection issues.
Initial Setup and Environment
Before diving into the troubleshooting steps, ensure that you have the following setup:
- A designated Android folder in
C:\Users\\AppData\Local
. - Cmdline-tools and platform-tools installed within that folder.
- Build-tools package version 28.0.3 installed via the
sdkmanager
command. - Your environment variables are set with Windows 10, Appium version 1.22.0, Node v14.17.6, Npm 6.14.15, and Sdkmanager 4.0.1.
Common Connection Error
If you encounter the error message “Failed to create session. The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource,” follow the steps below to resolve the issue.
Configuring Appium Server GUI
Adjust the Appium Server settings as follows:
- Open the Appium Server GUI and navigate to the Advanced tab.
- Set the Server address to
localhost
. - Ensure the Port is set to
4723
. - Enable the option to Allow CORS.
Setting Up Appium Inspector
Configure the Appium Inspector with the correct parameters:
- Set the Remote host to
localhost
. - Confirm the Port is
4723
. - For the Path, input
/wd/hub
. - Check the option to Allow Unauthorized Certificates.
- Select the desired capabilities for your device and application.
Starting the Server and Inspector
Once you have configured both the Appium Server GUI and Inspector with the settings above, start the server. After the server is running, launch the Appium Inspector to establish a connection with your Android device.
In Summary
Ensuring that both the Appium Server and Inspector are configured to communicate via localhost and that the correct port and path are set should resolve most connection issues. Remember to start the Appium Server before launching the Inspector, and verify that your device’s desired capabilities are correctly inputted. With these steps, you should be able to connect the Appium server and inspector with your smartphone successfully.