elixir-wallaby / wallaby

Concurrent browser tests for your Elixir web apps.
https://twitter.com/elixir_wallaby
MIT License
1.67k stars 197 forks source link

xpath selectors need to use exact text for label fields. #306

Open keathley opened 7 years ago

keathley commented 7 years ago

This is based on #257. Currently our xpath selectors for label text use contains(#{actual_text}). This can lead to "Multiple Element Errors" if 2 different fields have similar label texts. I think it would be good to match against the exact label text for an element instead of using contains(). This change would require users to use a fully qualified label text but, anecdotally, thats all I've ever seen anyone do in practice anyway.

zedtux commented 6 years ago

@keathley what about this issue? I'm facing exactly the issue as @jeffdeville in my application (Password and Password confirmation) and I'm looking for a solution.

keathley commented 6 years ago

For now you should be able to use the id of the element like text_field("password") and text_field("password_confirmation").

zedtux commented 6 years ago

Thank you @keathley it is working 👍 but still do you have an idea when this could be addressed?

keathley commented 6 years ago

I'll try to prioritize this fix.