fysh711426 / UndetectedChromeDriver

GNU General Public License v3.0
172 stars 65 forks source link

hide cmd command when calling chromedrive #10

Open vudonblog opened 2 years ago

vudonblog commented 2 years ago

I tried using undetected chromedrive but when calling chromedrive it shows command cmd how to hide it?. thank you.

vudonblog commented 2 years ago

Normally I can use HideCommandPromptWindow to hide it but when you use it, you don't know how to hide it.

fysh711426 commented 2 years ago

Ok, I try.

fysh711426 commented 2 years ago

I added hideCommandPromptWindow parameter, it can be used for Hide selenium command prompt window.

_driver = UndetectedChromeDriver.Create(
    options: options,
    driverExecutablePath: driverExecutablePath,
    // hide selenium command prompt window
    hideCommandPromptWindow: true);

I released a alpha package, you can try it.

PM> Install-Package Selenium.UndetectedChromeDriver -Version 1.0.5-alpha2
vudonblog commented 2 years ago

Thank you very much it worked well.

vudonblog commented 2 years ago

One more thing I want to ask you I use options.AddExtension (pathfilecrx); to add Excention in .crx format but it doesn't work

fysh711426 commented 2 years ago

Try it.

options.AddArgument("--load-extension=extensionDirectory")

In UndetectedChromeDriver, other functions except AddArgument cannot be used, the code will use the Arguments parameter to start the chrome process.

var args = options.Arguments
    .Select(it => it.Trim())
    .Aggregate("", (r, it) => r + " " +
        (it.Contains(" ") ? $"\"{it}\"" : it));
var info = new ProcessStartInfo(options.BinaryLocation, args);
...
var browser = Process.Start(info);
fysh711426 commented 2 years ago

https://github.com/fysh711426/UndetectedChromeDriver/issues/9#issuecomment-1159780698