Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to click a "type=submit" button in Playright

I tried any possible way to click a "type=submit" button in a form, but it doesn’t click the button, the only way is by using "text = ‘ Register ‘" but I can’t use the text because the form language may change based on the UI language selected by the user.

public Task ClickRegister() => Page.Locator("type=submit").ClickAsync();

Here is the FE code:

<button _ngcontent-yyv-c173="" type="submit" class="btn btn-primary"> Register </button>

I’m using Visual Studio

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

That’s not a valid selector. Can you try something like BUTTON[type="submit"]?

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading