Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not starting in headless mode #50

Open
hakeatos opened this issue Mar 25, 2023 · 1 comment
Open

not starting in headless mode #50

hakeatos opened this issue Mar 25, 2023 · 1 comment

Comments

@hakeatos
Copy link

simple code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using SeleniumUndetectedChromeDriver;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    private async void button1_Click(object sender, EventArgs e)
    {
        var options = new ChromeOptions();
        //options.AddArguments("--window-size=600,600");

//options.AddArguments("--headless");
using (var driver = UndetectedChromeDriver.Create(
driverExecutablePath:
await new ChromeDriverInstaller().Auto(),
// hideCommandPromptWindow: true,
headless: true,
options: options

            )
               
            )

        {
            driver.Navigate().GoToUrl("https://www.twitch.tv/axtlol");
            Thread.Sleep(7000);
            var screenshot = driver.GetScreenshot();
            screenshot.SaveAsFile("screenshot.png", ScreenshotImageFormat.Png);
        }

    }
}

}

@fysh711426
Copy link
Owner

fysh711426 commented Mar 25, 2023

Use options.AddArguments("--window-size=600,600") and change

driver.Navigate().GoToUrl("https://www.twitch.tv/axtlol");

to

driver.GoToUrl("https://www.twitch.tv/axtlol");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants