Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does using excludeSwitches in c#

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");
like image 658
mtest Avatar asked May 31 '26 13:05

mtest


1 Answers

        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();
        }
like image 82
user11504532 Avatar answered Jun 02 '26 03:06

user11504532



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!