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

Allow to define array of locator functions as a interactor's locator #184

Open
wKich opened this issue Feb 16, 2022 · 1 comment
Open

Allow to define array of locator functions as a interactor's locator #184

wKich opened this issue Feb 16, 2022 · 1 comment

Comments

@wKich
Copy link
Member

wKich commented Feb 16, 2022

For example, this is a locator of material-ui Button

.locator((element) => element.getAttribute("aria-label") ?? element.innerText)

As you can see, buttons can be located by aria-label attribute and by innerText. But the problem is if we have a button with both aria-label and innerText values, we can't find that button by innerText value, because our locator return the first value from aria-label attribute.

So I suggest to add ability to define an array of functions as locator. So locator could be look like this:

.locator([
  (element) => element.getAttribute("aria-label"),
  (element) => element.innerText
])

And then you can find your button by any of these possible ways.

@cowboyd
Copy link
Member

cowboyd commented Feb 28, 2022

I'm off two minds on this. It sounds easier, but how often do you really want to have it be both? In the case of MUI what is the case where the inner text and the aria label are different (I'm guessing that there is, but just curious what it is)

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