05-21-2023, 06:39 PM
Hey guys,
first I would like to send a thank to Gintaras, for this amazing software
In addition to meeting my needs in terms of automation, LibreAutomate allowed me to discover and start with C#.
I would like to contribute, so I'm sharing this useful alternative to Selenium, which allow an other approach regarding browser automation.
With PuppeteerSharp the browser Chromium is embedded and is by default updated every time you run the code (can be a fix version).
You can chose to launch it with Headless mode enable or disable.
The browser can be easily set to keep the sessions and the coockies, which I find really useful.
You can find more here https://www.puppeteersharp.com/index.html
Just for information, below is a sample code to generate a PDF file from a website page.
The "UserDataDir" allow to save the session as with a common browser.
Hope that can help.
first I would like to send a thank to Gintaras, for this amazing software
In addition to meeting my needs in terms of automation, LibreAutomate allowed me to discover and start with C#.
I would like to contribute, so I'm sharing this useful alternative to Selenium, which allow an other approach regarding browser automation.
With PuppeteerSharp the browser Chromium is embedded and is by default updated every time you run the code (can be a fix version).
You can chose to launch it with Headless mode enable or disable.
The browser can be easily set to keep the sessions and the coockies, which I find really useful.
You can find more here https://www.puppeteersharp.com/index.html
Just for information, below is a sample code to generate a PDF file from a website page.
The "UserDataDir" allow to save the session as with a common browser.
/*/ nuget -\PuppeteerSharp; /*/
using System.Windows.Forms;
using PuppeteerSharp;
using var browserFetcher = new BrowserFetcher();
await browserFetcher.DownloadAsync(BrowserFetcher.DefaultChromiumRevision);
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
Headless = false,
UserDataDir = @"D:\LibreAutomate - WorkSpaces\LibreAutomate\files\UserData" // Spécifiez le répertoire souhaité pour stocker les données du profil utilisateur
});
var page = await browser.NewPageAsync();
await page.GoToAsync("https://fr.wikipedia.org/wiki/Mario_Kart:_Super_Circuit");
await page.PdfAsync(@"D:\test\page.pdf");
// Fermez la page
await page.CloseAsync();
Hope that can help.