Reputation: 21
Python code works:
import time
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-automation'])
But the C# code is not working:
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddAdditionalCapability("excludeSwitches", "disable-popup-blocking");
Upvotes: 2
Views: 4492
Reputation: 21
I use "excludeSwitches" to get rid of the error showing on the output console. A device attached to the system is not functioning error using ChromeDriver Selenium on Windows OS
This is my code:
var options = new ChromeOptions();
List<string> ls = new List<string>();
ls.Add("enable-automation");
ls.Add("excludeSwitches");
ls.Add("enable-logging");
ls.Add("disable-popup-blocking");
options.AddExcludedArguments(ls); //set option element in list to options
IWebDriver driver = new ChromeDriver(options); //open webdriver with your options
Upvotes: 2
Reputation: 71
List<string> ls = new List<string>();
ls.Add("enable-automation");
ChromeOptions options = new ChromeOptions();
options.AddExcludedArguments(ls);
using (IWebDriver driver = new ChromeDriver("C:\\Program\\chromedriver", options))
{
Console.ReadKey();
}
Upvotes: 7