Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98807

How do I make Chrome Headless after I login manually

$
0
0

I am testing my site. I want the chrome browser to go headless after I manually enter the login credentials.

My selenium code to connect to the website.

    var driverService = ChromeDriverService.CreateDefaultService(); 
    ChromeOptions chromeOptions = new ChromeOptions();
    chromeOptions.AddArgument("--start-maximized");
    chromeOptions.AddArgument("no-sandbox");
    //chromeOptions.AddArgument("--headless");

    driver.Navigate().GoToUrl("exampleDOTcom");

    while (true)
    {
        Console.WriteLine("Login and Press Enter");
        Console.ReadLine();
        if (CheckLoggedIn())
            break;
    }
    //driver = new ChromeDriver(driverService, chromeOptions, 
    TimeSpan.FromSeconds(180));
    chromeOptions.AddArgument("--headless");

Viewing all articles
Browse latest Browse all 98807


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>