C# 为什么在c中使用ExcludeSwitch
Python代码可以工作:C# 为什么在c中使用ExcludeSwitch,c#,python,selenium,C#,Python,Selenium,Python代码可以工作: import time from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains options = webdriver.ChromeOptions() options.add_experimental_option('excludeSwitches', ['enable-automation']) 但C代码不起作用: Chrome
import time
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-automation'])
但C代码不起作用:
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddAdditionalCapability("excludeSwitches", "disable-popup-blocking");
你能给这个不知从何而来的代码添加一些解释吗?如果你能解释他做错了什么,你做了什么改变使它工作,以及为什么,这将有助于OP。你能给这个不知从何而来的代码添加一些解释吗?如果你能解释他做错了什么,你做了什么改变使它工作,以及为什么,这将对OP有所帮助;在C语言中,我使用以下句子:chromeOptions.addexcludedargumentable-automation;
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();
}