Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PuppeteerSharp in LA
#1
The following code can be executed successfully in LinqPad, but cannot open the webpage in LA

Code:
Copy      Help
/*/ nuget Pts\PuppeteerSharp; /*/

using PuppeteerSharp;

Environment.CurrentDirectory = @"C:\Users\Administrator\Desktop";

static async void DoScreenshot(string url)
{

    using var browserFetcher = new BrowserFetcher();
    await browserFetcher.DownloadAsync();
    await using var browser = await Puppeteer.LaunchAsync(new LaunchOptions
    {
        Headless = false,
        UserDataDir = @$"{folders.Temp}\chrome\UserData"
    });
    
    await using var page = await browser.NewPageAsync();
    await page.SetViewportAsync(new ViewPortOptions
    {
        Width = 1920,
        Height = 1080
    });
    await page.GoToAsync(url);
    await page.ScreenshotAsync("test.jpg");
    await browser.CloseAsync();
}

DoScreenshot("https://www.libreautomate.com/");


Messages In This Thread
PuppeteerSharp in LA - by Davider - 03-13-2024, 11:25 PM
RE: PuppeteerSharp in LA - by Gintaras - 03-14-2024, 05:10 AM
RE: PuppeteerSharp in LA - by Davider - 03-14-2024, 11:45 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)