0

I'm unable to execute with all the answers in internet, of how I can execute this porject in headless mode.

This is an example of how I run my project:

namespace Automation.TestCases
{
    public class MailContactManagement
    {

        IWebDriver driver = new FirefoxDriver();

        [OneTimeSetUp]
        public void Initialize()
        {

            driver.Navigate().GoToUrl(VariablesConstants.BaseURL);
            ActionModules.SignIn(driver);
            Assert.IsTrue(driver.FindElement(By.CssSelector(".badge-initials-mini")).Displayed);
        }

        [Test]
        [Ignore("Ignore Test")]
        public void TC_3340() // Create Mail
bsullit
  • 101
  • 3
  • 11
  • Which version of Firefox and geckodriver do you have? According to [this question ](https://stackoverflow.com/questions/46848615/headless-firefox-in-selenium-c-sharp) there is minimum version needed. And if you have the right version, what is the error? – Nikolaus Sep 19 '19 at 15:43
  • Possible duplicate of [Headless Firefox in Selenium C#](https://stackoverflow.com/questions/46848615/headless-firefox-in-selenium-c-sharp) – Greg Burghardt Sep 19 '19 at 15:50
  • Are you trying to run TC_3340? You realize that you have an Ignore set on it? – JeffC Sep 19 '19 at 16:21
  • HTMLUnit works pretty well for this... there's also a headless option for ChromeDriver. – pcalkins Sep 19 '19 at 18:11

1 Answers1

1

Add the --headless argument when starting the browser:

  FirefoxOptions options = new FirefoxOptions();
  options.addArguments("--headless");
  WebDriverManager.firefoxdriver().setup();
  driver = new FirefoxDriver(options);

(this example is in Java.. C# will allow something similar)

Corey Goldberg
  • 59,062
  • 28
  • 129
  • 143
IPolnik
  • 619
  • 5
  • 13