0

I want to press the submit button that looks like this

<input type="submit" name="ok" value="example" class="ibro_schalter_03">

I would use '[name=ok]' but there are other buttons next to each other that also have the same name.

When i tried to use '[value=example]' I got an error

Error: Evaluation failed: DOMException: Failed to execute 'querySelector' on 'Document': '[value=example]' is not a valid selector.

Can i get some help with it?

mplungjan
  • 169,008
  • 28
  • 173
  • 236
  • Is `example` the actual value? If you have "schalter-eins" then you need to escape or quote the dash - In the browser you can use CSS.escape(value) but that might not be available to node [more here](https://stackoverflow.com/questions/52251592/puppeteer-escape-square-brackets-in-selector) – mplungjan Oct 06 '21 at 07:17

2 Answers2

1

Change '[value=example]' to '[value="example"]

Posandu
  • 525
  • 6
  • 18
0

Converting my comment to answer

Is example the actual value? If you have "schalter-eins" then you need to quote the value: '[value="schalter-eins"]'

Alternatively escape the value - In the browser you can use CSS.escape(value) but that might not be available to node more here

mplungjan
  • 169,008
  • 28
  • 173
  • 236