minkphp / minkphp/Mink

Allow named selector to not do partial matching

Open
#880 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.6k
Forks
286
PR merge metrics
No merged PRs in 30d

Description

Hi, thanks for all the work over the years on this! ❤️

I searched and couldn't find a matching issue (tho #872 covers the same area of the codebase). I'd love to be able to choose to have strict matching when using the named selector (ie named behaves identically to named_exact). It seems currently that the behavior's hardcoded:

https://github.com/minkphp/Mink/blob/9b08f62937c173affe070c04bb072d7ea1db1be5/src/Element/ElementFinder.php#L48-L57

And the element finder's instantiated directly in the session constructor:

https://github.com/minkphp/Mink/blob/9b08f62937c173affe070c04bb072d7ea1db1be5/src/Session.php#L42-L50

From my perspective it'd be great to either have a way to override the element finder with my own custom class, or to update the default Mink finder to support switching off fallback partial matching.

Do either of those approaches sound like something you'd consider? If not, is there maybe some other solution?

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/Element/ElementFinder.php at lines 48-57 to understand the hardcoded named-selector fallback, then inspect src/Session.php at lines 42-50 to see how the finder is created. Review the discussion around choosing a custom finder versus switching off partial matching. Done means named selectors can opt out of partial matching while named_exact remains consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.