mte*_*est 1 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'])
Run Code Online (Sandbox Code Playgroud)
但是 C# 代码不起作用:
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddAdditionalCapability("excludeSwitches", "disable-popup-blocking");
Run Code Online (Sandbox Code Playgroud)
小智 5
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();
}
Run Code Online (Sandbox Code Playgroud)