3

I've been having trouble around finding elements by attribute/property. Following UI visible example:

<input tabindex="0" placeholder="www.stuff.com/example" type="text" id="sub-selector-37" class="form-control" value="">

The unique piece is the placeholder text.

I've tried the following:

And waitFor('input[placeholder=www.stuff.com/example]')  - Error
And waitFor('input[placeholder="www.stuff.com/example"]') - Error
And waitFor('input[placeholder='www.stuff.com/example']') Finds nothing

Also tried a more direct input approach:

Then waitFor('{}Something else')
Then input('input[placeholder=www.stuff.com/example']', 'Stuff')

I'm hoping this is just good old PEBKAC on my part. Any suggestions would be greatly appreciated.

Puti
  • 101
  • 8

1 Answers1

2

Here you go, use double-quotes and nest single-quotes:

And waitFor("input[placeholder='www.stuff.com/example']")

A tip: use the debugger and you can experiment with things like highlightAll('input') and narrow down what works: https://twitter.com/KarateDSL/status/1252817691963830272

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • 1
    That solved the issue. Thank you! Im wondering how the highlight would assist for finding issues such as I had. I'll dig in a bit more. – Puti Jul 02 '20 at 04:59
  • For my (and colleagues) knowledge. How do we identify what needs single, double, or no quotes at all? – Puti Jul 02 '20 at 05:04
  • @Puti both are supported in JavaScript. single suffices most of the time. this is a case where you had to specify a string within a string :) so use double for the outer. does that make sense ? – Peter Thomas Jul 02 '20 at 05:11