Omenia / robotframework-whitelibrary

Library for automating Windows GUI technologies with Robot Framework. WhiteLibrary wraps the White automation framework.
Apache License 2.0
54 stars 15 forks source link

Using multiple locators for identifying an object #139

Open shaktim121 opened 5 years ago

shaktim121 commented 5 years ago

Is your feature request related to a problem? Please describe. The problem is while trying to identify an object with two or multiple locators Ex: I want to check the application for a button with text: Button1 and class_name: WinButton

Describe the solution you'd like Ex1: Click Button text:Button1 && class_name:WinButton Ex2: Click Button text:Button1 AND class_name:WinButton

MummanaSubramanya commented 5 years ago

@eeter : any update ? seems like method _get_search_criteria needs to be changed as it need to handle chain method SearchCriteria.ByAutomationId("foo").AndByText("bar"). Any idea how to implement may be I can help you in PR.

eeter commented 5 years ago

This would be a very useful feature. There has been some discussion around it but no one has yet looked into actually implementing it. @MummanaSubramanya if you are interested in implementing it that would be great!

As you said _get_search_criteria should be updated to handle multiple search strategies. It should able to parse the locators and then create the chained search criteria.

One of the questions I have had is what the locator syntax should be like for chained locators. I think that from a user's point of view the Ex2 by @shaktim121 is probably the clearest option:

Click Button    text:Button1 AND class_name:WinButton

With this syntax the user should have the possibility to escape the string "AND" in case the locator value itself contains it.