ChromeDriver console application hide

前端 未结 5 637
借酒劲吻你
借酒劲吻你 2020-12-01 18:04

I have created a player which will automate chrome using selenium and ChromeDriver in C#. It\'s working fine.

Issue what I am facing is, when it creates an object fo

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 18:43

    As an update to this question. Yes, you can hide command prompt window in Selenium 2.40.0 and up. Please note that hiding command prompt window is not recommended but you can do it. As the question refers to C# you do it with the next code:

    ChromeDriver

    var driverService = ChromeDriverService.CreateDefaultService();
    driverService.HideCommandPromptWindow = true;
    
    var driver = new ChromeDriver(driverService, new ChromeOptions());
    

    InternetExplorerDriver

    var driverService = InternetExplorerDriverService.CreateDefaultService();
    driverService.HideCommandPromptWindow = true;
    
    var driver = new InternetExplorerDriver(driverService, new InternetExplorerOptions());
    

    PhantomJSDriver

    var driverService = PhantomJSDriverService.CreateDefaultService();
    driverService.HideCommandPromptWindow = true;
    
    var driver = new PhantomJSDriver(driverService);
    

提交回复
热议问题