puppeteer-sharp icon indicating copy to clipboard operation
puppeteer-sharp copied to clipboard

target.asPage in puppeteer c#

Open bambinorest1 opened this issue 1 year ago • 1 comments

Is it possible to handle a CDP target of type "other" as a page? In puppeteer js i saw one, but i didn't find in this library. Here url to this method. https://pptr.dev/api/puppeteer.target.aspage

bambinorest1 avatar May 14 '24 17:05 bambinorest1

Yes! It works pretty similar

var devtoolsTargetTask = browser.WaitForTargetAsync(t => t.Type == TargetType.Other);
await browser.NewPageAsync();
var devtoolsTarget = await devtoolsTargetTask;
await using var page = await devtoolsTarget.AsPageAsync();

kblok avatar May 14 '24 19:05 kblok