Automation

Common Issues and Solutions

This documentation contains all the issues/errors encountered while setting up or running the automation test script using WebdriverIO.

Before we start

All the major issues related to the automation testing have been listed down below. Each issue contains a possible solutions as well with detailed description and reference screenshots.

Issues and Solutions

1. Error Message: "No matching capabilities found"

Description: This error mostly occures when the capabilities passed by the script does not match the system's configuration.

Solution:

  1. Verify the platform you are using. Eg. mac, linux or windows
  2. Open wdio.conf.js file. And search for capabilities.
  3. Open wdio.env.js file.
  4. Look for capabilities inside this.param.
  5. Verify the capabilities.
  6. The attribute platformName should contain the name of the platform you are trying to test. If it is wrong, update the platformName.
    platformName: "windows",        // For Windows
    platformName: "mac",            // For MacOS
    platformName: "Linux",          // For Linux
    platformName: "Android",        // For Android
    platformName: "iOS",            // For iOS
    
  7. Similarly check the other attributes as well.
  8. After updating the capabilities. Try to run the script using the command below.
    npm run wdio
    
  9. The issue should have been solved.

2. Error Message: "Details: session not created: This version of ChromeDriver only supports Chrome version"

Description: This issue occures when the package: appium-chromium-driver is outdated. Due to this there is a mismatch in the chrome browser version and the package.

Solution:

  1. Open the terminal in your project.
  2. Run the command given below to update the package: appium-chromium-driver.
    npm i appium-chromium-driver --save-dev
    
  3. Update the chrome browser to the latest version. Open Chrome > Settings > About Chrome
  4. Now excute the script by the running the commnd below:
    npm run wdio
    
  5. The issue should have been resolved.

3. Error Message: "The requested port may already be in use."

Refer:

Description: This error occurs when the HTTP server component of the application you're trying to start is unable to bind to the specified port because another process is already using it.

Solution:

  1. Open the terminal in your project folder.
  2. Run the command mentioned below based on your system:
    killall -KILL node         // For MacOS
    
    taskkill /F /IM node.exe   // For Windows
    
  3. Now, run your tests again and verify.

4. Error Message: "ECONNREFUSED 127.0.0.1:4723"

Description: The error ECONNREFUSED 127.0.0.1:4723 typically indicates that the connection to the Appium server running on localhost (127.0.0.1) at port 4723 was refused. This error commonly occurs in WebDriverIO Appium tests when the Appium server is not running or is unable to accept connections.

Solutions:

  1. Restart your IDE.
  2. Execute the tests again and verify.

5. Error Message: "ERROR @wdio/appium-service: dbug"

Refer:

Description: This issue occurs when there is a problem in the node modules for appium service.

Solution:

  1. Delete the node modules directory and package.lock.json file.
  2. Run the below command:
    npm install
    
  3. Wait for the command to finish.
  4. Run the below command to execute the script:
    npm run wdio
    

6. Error Message: "Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported."

Refer:

Description: This issue occurs when the ANDROID_HOME path is not added in the environment variables for Windows.

Solution: The solution for this issues have to be done in three steps:

  1. Set ANDROID_HOME in enviroment variables
    1. Press Windows+R and type the command %appdata% and press run.
    2. Navigate to the AppData folder.
    3. Click on the Local folder.
    4. Then, select the Android folder followed by the sdk subfolder.
    5. Copy the path of this folder.
    6. Proceed to Settings and navigate to About section.
    7. Click on Advanced Settings.
    8. Access Environment Variables.
    9. Create a new variable named ANDROID_HOME and paste the previously copied URL.
    10. Additionally, add this path to the system's PATH variable.
  2. Set ANDROID_SDK_ROOT in environment variables
    1. Press Windows+R and enter the command: %appdata%.
    2. Navigate to the AppData folder.
    3. Open the Android folder, then locate and enter the sdk subfolder.
    4. Inside that, access the tools folder.
    5. Copy the path of this folder.
    6. No separate variable creation is necessary for ANDROID_SDK_ROOT.
    7. In the system variables section, select the PATH variable and click on the edit button.
    8. Add the copied path to the system's PATH variable.
  3. Set JAVA_HOME in environment variables
    1. Navigate to Program Files directory in your C: drive.
    2. Open the Android folder, then locate and navigate to Android Studio directory.
    3. Locate the jbr folder inside it and proceed to the bin subfolder.
    4. Copy this path.
    5. Create a new variable named JAVA_HOME in environment variables and paste the copied URL.
    6. Additionally, append this path to the system's PATH variable.
    7. To verify, open Command Prompt and type: java -version
    8. The command should display the version of java installed on your system.
    9. After setting the path, the environment variables should look something like this:

After performing the steps mentioned above. The issue should have been fixed.


Copyright © 2024