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

Windows locators: unable to search element with trailing space in class name #1151

Open
ynerant opened this issue Feb 12, 2024 · 2 comments
Open

Comments

@ynerant
Copy link

ynerant commented Feb 12, 2024

Hi,

I am automating tests for an evil application that have class names that ends with a trailing whitespace.

Unfortunately, it seems impossible for now to match some such elements, since the locator query is trimmed.
I found some hack using subname or regex, but that only works for names and not for classes.

Do you know any hack that let find search my element by class name (for now I am doing differently), or is there any solution to fix that issue?

By the way, is it possible to locate only one class among multiple ones?

@kkotenko
Copy link
Contributor

Hi @ynerant, an approach I have used for similar problems in the past would be to:

  1. Get the parent element of the element you actually want
  2. Get a list of the children (I have found that Get elements regex:.* root_element=<parent> works best - in fact, it is about 30% faster than Print Tree with depth 1 for this)
  3. Iterate over the list
  4. Check the class of every element using Get Attribute. If it matches your search string, return.

If you wanted to check other properties of ${element} than those exposed by WindowsElement, you would have to do Evaluate $element.item.<propertyname>.

@ynerant
Copy link
Author

ynerant commented Feb 28, 2024

Humm yes, that works for my usage, but I think that it stays a bug of RPA Framework, so I think that I'll leave the issue open.

It would be nice if we can match a "subclass", either a substring of the class field, or if a windows element contains multiple classes separated by spaces, match on one of these classes.

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

2 participants