Home > OS >  Press the submit button using page.waitForSelector and page.click
Press the submit button using page.waitForSelector and page.click

Time:10-06

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?

CodePudding user response:

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

CodePudding user response:

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

  • Related