Ans Bilal
Ans Bilal

Reputation: 1067

Puppeteer Sharp submit form

I am trying to convert node.js code to C# and I am stuck at this point. I need to submit the form but I could not find any method in c#.

 await page.$eval('#my-form', form => form.submit()),

I could not find any function for $eval in C#. I have tried EvaluateExpressionAsync in C# but it seems like it executes our script inside the page. I do not want to trigger a click event on the button. I just want to translate that line of code in C#.

Upvotes: 1

Views: 995

Answers (1)

hardkoded
hardkoded

Reputation: 21695

In puppeteer sharp that's being solved using extension methods.

await page.QuerySelectorAsync("#my-form")
    .EvaluateFunctionAsync("form => form.submit()"); 

Upvotes: 3

Related Questions