Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindElementsByTagName("Window") returns zero results #632

Closed
mdesousa opened this issue Mar 15, 2019 · 7 comments
Closed

FindElementsByTagName("Window") returns zero results #632

mdesousa opened this issue Mar 15, 2019 · 7 comments
Assignees

Comments

@mdesousa
Copy link

I am trying to get a list of all the windows on the desktop with the code below. However, I get zero results... should this work?

var desktopCapabilities = new DesiredCapabilities();
desktopCapabilities.SetCapability("app", "Root");
desktopCapabilities.SetCapability("platformName", "Windows");
desktopCapabilities.SetCapability("deviceName", "WindowsPC");
using (var desktopDriver = new WindowsDriver<WindowsElement>(WindowsDriverUri, desktopCapabilities))
{
    var windows = desktopDriver.FindElementsByTagName("Window"); // returns zero results
}
@naeemakram
Copy link

I tried the following, it didn't return zero. But, it returned the wrong value.

var windows = desktopDriver.FindElementsByClassName("Window");

@timotiusmargo
Copy link
Contributor

Hi @mdesousa,

Would you please retry your scenario using WinAppDriver v1.1.1 release?

@mdesousa
Copy link
Author

It appears to work with v1.1.1... thanks! FYI, I noticed in the WinAppDriver console a number of exception warnings... the resultset still looked ok, don't know if those exceptions are concerning. See the output below... the "Exception" section (including the "Ignoring new object and keeping existing one" message) was repeated many times (more than 20?). It appears to display one entry for each email that I had opened in Outlook... I've obfuscated and left a single entry for illustration, but you can probably reproduce if you make this call while Outlook is open.

==========================================
POST /session/C36B34B7-9BEE-436A-9D02-E5E24BA05EEC/elements HTTP/1.1
Accept: application/json, image/png
Content-Length: 37
Content-Type: application/json;charset=utf-8
Host: 127.0.0.1:4723

{"using":"tag name","value":"Window"}

Exception: Encountered element sharing the same runtimeId 42.6490686.3.-2

    new Object {[OBFUSCATED], FromField, 42.6490686.3.-2}
    runtimeId 42.6490686.3.-2
    className FromField
    name [OBFUSCATED]
    NativeWindowHandle 0

    existing Object {[OBFUSCATED], FromField, 42.6490686.3.-2}
    runtimeId 42.6490686.3.-2
    className FromField
    name [OBFUSCATED]
    NativeWindowHandle 0


Ignoring new object and keeping existing one

HTTP/1.1 200 OK
Content-Length: 325
Content-Type: application/json

{"sessionId":"C36B34B7-9BEE-436A-9D02-E5E24BA05EEC","status":0,"value":[{"ELEMENT":"42.9836860"},{"ELEMENT":"42.793194"},{"ELEMENT":"42.12387662"},{"ELEMENT":"42.23466224"},{"ELEMENT":"42.6624114"},{"ELEMENT":"42.15603540"},{"ELEMENT":"42.14948448"},{"ELEMENT":"42.5576022"},{"ELEMENT":"42.18091894"},{"ELEMENT":"42.66734"}]}


==========================================

@timotiusmargo
Copy link
Contributor

timotiusmargo commented Mar 26, 2019

Hi @mdesousa,

Thanks for the update. I'm glad it works out very well for you. Yes there is an issue with one of the Outlook release where some distinct elements sharing the same runtimeId. They are aware of this and are working on a fix. These exceptions are merely warnings to help application developer identify the elements that share the runtimeId.

Having said that, as long as the warning messages doesn't come from your application, it shouldn't be a concern.

@anshilabhi
Copy link

anshilabhi commented Aug 26, 2024

Hi,
I am stuck with the same above error. I cannot do anything as the error keeps rolling and the winappdriver gets stuck, please help. I tried a couple of different versions of winappdriver but no help.

@naeemakram
Copy link

Share your XPath

@HowTurnRight
Copy link

@anshilabhi
What is you application framework? I had such issue when working on Sciter application. This framework have issue with handling invisible elements are not handled properly and they are returned in indefinite loop what cause winappdriver to stackoverflow exeption after all. The workarround is to do your querries in root elements where you are sure there is no duplicated looped elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants