My problem is: Iam trying to conext to http://example.com con Puppeteer Sharp and I want to show in the Console the text of de h1 tag from that page. The text is "Example Domain".
I have this code:
await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision);
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
Headless = true
});
using (var page = await browser.NewPageAsync())
{
await page.GoToAsync("http://example.com");
await page.WaitForSelectorAsync("h1");
var texto = await page.QuerySelectorAsync("h1");
Console.WriteLine(texto.ToString());
}
await browser.CloseAsync();
but the Console shows "JSHandle@node". How Can I take the value of the h1 from the JSHandle@node?
Thank you a lot.