The application Selenium, after running the console remains on the screen. Threw everything out of the code, left only the initialization and closing of the driver - everything is still the same. What to do?

using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using System; namespace Myspace { class Program { static void Main(string[] args) { IWebDriver driver = new ChromeDriver(); driver.Close(); } } 

    1 answer 1

    Try this:

     using OpenQA.Selenium; using OpenQA.Selenium.Chrome; namespace ConsoleApp4 { public class Program { private static void Main() { IWebDriver driver = new ChromeDriver(); driver.Quit(); } } } 

    It seems that this is a bug, on their bug tracker a bug is running.

    WebDriver.close () does not close browser window

    UPD : By the way, if you use the using statement, then everything closes correctly:

     private static void Main() { using (IWebDriver driver = new ChromeDriver()) { } //driver.Quit(); } 

    Because the Dispose method just uses the Quit operation:

     protected virtual void Dispose(bool disposing) { try { this.Execute(DriverCommand.Quit, null); } /*...*/ } 
    • The link would at least lead to a bug. - αλεχολυτ