Test in anonymous window on Seleniumwebdriver

Asked

Viewed 69 times

0

I’m trying to get Selenium to run the tests in Firefox’s private window, but the execution is still done in the default window. Something is missing?

private IWebDriver driver;
        public IDictionary<string, object> vars { get; private set; }
        private IJavaScriptExecutor js;
        [SetUp]
        public void SetUp()
        {
            driver = new FirefoxDriver();
            FirefoxProfile firefoxProfile = new FirefoxProfile();
            firefoxProfile.SetPreference("browser.privatebrowsing.autostart", true);
            driver.Manage().Window.Maximize();
            js = (IJavaScriptExecutor)driver;
            vars = new Dictionary<string, object>();
        }
        [TearDown]
        protected void TearDown()
        {
            driver.Quit();
        }
        [Test]
        public void teste()
        {
        xxxx
        xxxxx
        xxxxx
        }

  • tries to add the argument firefoxProfile.addArguments("-private");

  • 'Firefoxprofile' does not contain a Definition for 'addArguments' and no accessible Extension method 'addArguments' Accepting a first argument of type 'Firefoxprofile' could be found

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.