1

I have tried to set the argument as options.addArguments("--headless"); but it's not working. Please note that I don't want to use setHeadless(Boolean) method since it's deprecated now.

I have a working Chrome in headless with the following code:

ChromeOptions options = new ChromeOptions();
options.addArguments("--headless=new");

driver = WebDriverManager.chromedriver().capabilities(options).create();

And I want to do the same with Firefox. When I use options.addArguments("--headless"); it can not interact with the page element. I'm assuring that there are no other element to obscure the interactable element.

1 Answers1

0

Its mentioned in Firefox options docs use "-headless" or "--headless" also works

addArguments("-headless")

complete

    FirefoxOptions options = new FirefoxOptions();
    options.addArguments("-headless");
    WebDriver driver = new FirefoxDriver(options);
Abhay Chaudhary
  • 1,763
  • 1
  • 8
  • 13