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

Provide an option to control the order of locators(elements) to be returned when more than one condition is met while using OR operator in the PageYAML #314

Open
mvelu opened this issue Sep 6, 2016 · 1 comment

Comments

@mvelu
Copy link

mvelu commented Sep 6, 2016

Selion always picks and returns only the last element locator when two locators in OR conditions are matched and available in the Page. Need an option to Pick any matching locators based on the request from the customer.
US: "//android.widget.TextView[1]| //android.widget.TextView[2] | //android.widget.TextView[3]"
In the above case when TextView[2] and TextView[3] are available in the page, Selion always find and return only android.widget.TextView[3].

@mvelu mvelu changed the title Provide an option to control the order of locators(elements) to be returned when more than one condition is met while using OR operator Provide an option to control the order of locators(elements) to be returned when more than one condition is met while using OR operator in the PageYAML Sep 6, 2016
@mach6 mach6 added this to the 2.0.0 milestone Sep 8, 2016
@ILikeToNguyen
Copy link
Contributor

ILikeToNguyen commented Sep 13, 2016

I assume the API call you are making is getLocator on webelements that extend AbstractElement such as Link, Button, etc.

Two proposals:
A. public String getLocator()
Will return the full path in yaml, so in your example it will return
//android.widget.TextView[1]| //android.widget.TextView[2] | //android.widget.TextView[3]

B. Leave getLocator's behavior as is and create a new method, public String getLocators, which will return
//android.widget.TextView[1]| //android.widget.TextView[2] | //android.widget.TextView[3]

The only thing bad about option A is that we could break potential users who expect the behavior of this operation to return a true xpath. I can't remember if the | symbol is selion specific delimiter or selenium will take an xpath with | symbols in it. If its the former, then we will break users who are using getLocator and taking that string directly to use with APIs that take a true XPATH.

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

No branches or pull requests

3 participants