none
WinAppDriver couldn't find the elements of WPF application RRS feed

  • Question

  • I am new to automation and I am trying to automate the WPF application using WinAppDriver with C#. I am able to load the application but getting the error like {"An element could not be located on the page using the given search parameters."} while trying to find the element with Name/AccessibilityId even after keeping the wait time.

    See below:

    POST /session/09551C9F-CF20-4C2B-A900-F17D2483F9D8/element HTTP/1.1
    Accept: application/json, image/png
    Content-Length: 45
    Content-Type: application/json;charset=utf-8
    Host: 127.0.0.1:4723

    {"using":"accessibility id","value":"TxtPwd"}
    HTTP/1.1 404 Not Found
    Content-Length: 139
    Content-Type: application/json

    {"status":7,"value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters."}}

    I don't know what is happening. Any suggestions?

    I did like:

    - check for the elements and automation-id/name of element through inspect tool

    - set developer mode active

    - wait time before finding the element

         var aDesiredCapabilities = new DesiredCapabilities();
                 aDesiredCapabilities.SetCapability("app", @"PathToApplication");
                 aDesiredCapabilities.SetCapability("deviceName", "Windows 10");

                 var aWindow = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), aDesiredCapabilities);
                 aWindow.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);

                 aWindow.FindElementByAccessibilityId("TxtPwd").SendKeys("qwerty");
                 aWindow.FindElementByAccessibilityId("TxtUser").SendKeys("123456");
                 aWindow.FindElementByAccessibilityId("Clear").Click();

                 aWindow.FindElementByAccessibilityId("TxtPwd").SendKeys("qwerty");
                 aWindow.FindElementByAccessibilityId("TxtUser").SendKeys("123456");
                 aWindow.FindElementByAccessibilityId("Login");

     
    Thursday, October 17, 2019 3:51 AM

All replies

  • Hi,

    Thanks for posting here.

    This problem is more related to WinAppDriver. WinAppDriver is a libriary/service which publiced on github, and currently this repro is active. We suggest to open a issue under the repro bleow to get more effective suppport:
    https://github.com/microsoft/WinAppDriver

    Best Regards,

    Drake


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, October 21, 2019 7:06 AM
    Moderator