I am trying to automate a website test using JavaScript. Part of my tests include clicking a button that has a type, but no id.
I've tried to do this using a jQuery code that I found online but it didn't work. Is there any way to simulate the click using the type of the button?
This is the HTML of the button I am trying to target:
<button type="submit">Go</button>
jQuery('[type="button"]')as for simulating the click and triggering an event listener you would use jQuery'strigger()method. But if that didn't work you need to explain exactly you want to happen when that button is clicked, eg event handler trigger vs something like default form submission from button click