Well, I'm trying to disable this popup, because a NoSuchElementException
occurs because this is interfering on the UI.
private static ChromeDriver CreateDriver()
{
var chromeOptions = new ChromeOptions();
//{
// BinaryLocation = Path.Combine(Environment.CurrentDirectory, "chromedriver/chromedriver"),
//};
/*
// ONLY FOR TESTING IN WINDOWS
chromeOptions.AddArguments("headless");
chromeOptions.AddArgument("--start-maximized");
//chromeOptions.AddArgument("window-size=932,1025");
chromeOptions.AddArgument("--disable-infobars");
chromeOptions.AddArgument("--disable-dev-shm-usage");
chromeOptions.AddArgument("--no-sandbox");
chromeOptions.AddArgument("--remote-debugging-port=9222");
*/
chromeOptions.AddArgument("--no-sandbox");
chromeOptions.AddArgument("--disable-infobars");
chromeOptions.AddArgument("--disable-extensions-file-access-check");
chromeOptions.AddArgument("--disable-extensions");
chromeOptions.AddArguments("--lang=en");
// --disable-extensions-file-access-check
//chromeOptions.AddAdditionalOption("useAutomationExtension", false);
chromeOptions.AddExcludedArgument("enable-automation");
chromeOptions.AddArgument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36");
if (IsLinux)
{
// Thanks to: https://stackoverflow.com/questions/41133391/which-chromedriver-version-is-compatible-with-which-chrome-browser-version
// https://chromium.woolyss.com/
var service = ChromeDriverService.CreateDefaultService();
service.LogPath = Path.Combine(Environment.CurrentDirectory, "logs", "client.log");
service.EnableVerboseLogging = true;
chromeOptions.AddArguments("headless");
chromeOptions.AddArgument("--start-maximized");
//chromeOptions.AddArguments("--headless");
//chromeOptions.AddArguments("--disable-gpu");
//chromeOptions.AddArguments("--window-size=1280,800");
//chromeOptions.AddArguments("--allow-insecure-localhost");
//chromeOptions.AddArgument("--disable-infobars");
//chromeOptions.AddArgument("--disable-dev-shm-usage");
//chromeOptions.AddArgument("--no-sandbox");
//chromeOptions.AddArgument("--remote-debugging-port=9222");
return new ChromeDriver(service, chromeOptions);
}
return new ChromeDriver(chromeOptions);
}
This options is what I tried, but the popup is still showing.
chromeOptions.AddArgument("--disable-infobars");
chromeOptions.AddArgument("--disable-extensions-file-access-check");
chromeOptions.AddArgument("--disable-extensions");
In Java I saw this option also: System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
But obviously I don't have any change to reimplement this on C#. So I don't know where can I continue.
This popup shows only when the chromeOptions.AddArgument("--no-sandbox");
option is exposed (this is obligatory in Linux). So I don't know what do exactly.
Any help here would be wonderful!
Note: I'm using ChromeDriver 79.0.3945.36