'Set input value with Puppeteer-Sharp

I try to do this but I get an exception :

var text = "hello";
var input = await page.QuerySelectorAsync("input");
var button = await page.QuerySelectorAsync("button");
await input.EvaluateFunctionAsync($"e => e.value = '{text}'");
await button.EvaluateFunctionAsync("e => e.click()");

what is the correct way to set a value of an input with puppeteer sharp ?



Solution 1:[1]

using below,

using var page = browser.NewPageAsync().Result;

page.TypeAsync("input[name='elementname']", valuetobeset).Wait();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mahesh