10 November 2024 Leave a comment Tech-Help
If you’re attempting to automate testing for the Windows Calculator app on Windows 10 using WinAppDriver, Appium, and Java, you might encounter the error: UnsupportedCommandException: The URL '/session' did not map to a valid resource
. This error typically arises from incorrect URL configurations when initiating your test session.
Solution Approaches
1. Clarifying the Use of Appium and WinAppDriver
It’s crucial to decide whether you’re using the Appium server or the WinAppDriver executable. Avoid running both simultaneously to prevent conflicts. Here are the configurations based on your choice:
-
Using Appium Server: Ensure that you append
/wd/hub
to your URL:CalculatorSession = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
-
Using WinAppDriver Directly: Use the IP and port without
/wd/hub
:CalculatorSession = new IOSDriver(new URL("http://127.0.0.1:4723"), capabilities);
2. Using the Correct Application Identifier
When specifying the Calculator app, use the correct identifier:
capabilities.setCapability("app", "Microsoft.WindowsCalculator_8wekyb3d8bbwe!App");
This ensures that the application is correctly targeted during the test automation process.
3. Addressing Appium 2.0 Changes
For those using Appium 2.0, ensure that your URL does not inadvertently include a trailing slash after the port number:
appium_url = "http://0.0.0.0:4723";
Enhancing Your Automation with Repeato
While configuring Appium and WinAppDriver can be complex, Repeato offers a streamlined alternative for mobile test automation. As a no-code test automation tool, Repeato simplifies the creation, execution, and maintenance of tests for iOS and Android apps. Its use of computer vision and AI enables faster test execution compared to traditional tools like Appium, which can often be slow and unstable. For more information on leveraging Repeato for your testing needs, visit our documentation.