You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! When I launch puppeteersharp from console app (started from scheduler), it is headless, despite I set headless=false in setup:
`public static class PuppeteerUtils
{
// Method to initialize and launch the browser
public static async Task<IBrowser> InitBrowserAsync()
{
// Initialize the WebProxy object if needed
WebProxy proxy = null;
// Get the path to the "My Documents" folder
string myDocumentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
// Combine it with "Global_runtime" and "puppeteer"
string customBrowserPath = Path.Combine(myDocumentsPath, "Global_runtime", "puppeteer");
string rootBrowserCachePath = Path.Combine(myDocumentsPath, "Global_runtime", "BrowserCache");
// Initialize BrowserFetcher with the custom path
var browserFetcherOptions = new BrowserFetcherOptions { Path = customBrowserPath };
var browserFetcher = new BrowserFetcher(browserFetcherOptions);
// Download the browser if not already downloaded
var installedBrowser = await browserFetcher.DownloadAsync();
var browserCachePath = Path.Combine(rootBrowserCachePath, "localhost");
if (!Directory.Exists(browserCachePath))
Directory.CreateDirectory(browserCachePath);
var launchOptions = new LaunchOptions
{
ExecutablePath = installedBrowser.GetExecutablePath(), // Get the path of the downloaded Chromium
Args = new string[]
{
"--start-maximized", // Start in maximized window
"--disable-extensions", // Disable extensions
"--disable-infobars", // Disable the infobars
"--disable-blink-features=AutomationControlled", // Prevent detection of automation
"--no-sandbox", // Optional: Disable sandbox (depending on the environment)
"--disable-setuid-sandbox"
},
DefaultViewport = null,
UserDataDir = browserCachePath,
Headless = false
};
return await Puppeteer.LaunchAsync(launchOptions);
}
}`
Can I fix that to always under any circumstances run with window?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello! When I launch puppeteersharp from console app (started from scheduler), it is headless, despite I set headless=false in setup:
`public static class PuppeteerUtils
{
}`
Can I fix that to always under any circumstances run with window?
Beta Was this translation helpful? Give feedback.
All reactions