browser icon indicating copy to clipboard operation
browser copied to clipboard

$selector ambiguity

Open kbond opened this issue 4 years ago • 2 comments

The method parameter $selector is used in several methods and means different things depending on the context:

  • css selector: ->assertSeeIn('h1', 'some text') or ->dump('h1')
  • link selector (link id/title/text/image alt): ->follow('some link')
  • button selector (button id/value/alt): ->click('button')
  • field selector (input id/name/label): ->fillField('name', 'Kevin')
  • json search expression: ->assertJsonMatches('foo.bar.baz', 1) or ->dump('foo.bar.baz') (when content-type is json)

I think adding good docblocks would help but there are some things that can be improved:

Right now, methods that select elements with link/button/field selectors cannot use css selectors to find the element. I think, if unable to find the element via the link/button/field selector, assume a css selector and try.

This opens up the possibility of clicking buttons via tr:contains(First Post) a.btn (think admin list of entities each with an edit button).

kbond avatar Dec 24 '20 19:12 kbond

Oh, yes please.

I have been trying different values because I dont 100% know what "selector" means for different methods. I also tried .checkbox label without success.

Nyholm avatar Oct 02 '21 18:10 Nyholm

I have been slowly working on removing mink and replacing with a system that will help here. It will include an "escape hatch" where you can take complete control with the Dom crawler.

Should have a PR ready in the next few weeks.

kbond avatar Oct 02 '21 20:10 kbond