2

I have tried

options.add_argument("--headless") driver = new ChromeDriver(options) 

it's working fine but my requirement is to hide it after initialization.

1
  • What do you mean hide it after initialization? how what you want is different from using headless? Commented Jan 1, 2020 at 10:02

2 Answers 2

1

As you can see here: How to execute tests with selenium webdriver while browser is minimized there is no way for the browser to be minified.

You could in theory move the browser out of view as described here https://sqa.stackexchange.com/questions/15484/how-to-minimize-the-browser-window-which-was-launched-via-selenium-webdriver

driver.manage().window().setPosition(new Point(-2000, 0)) 

Chrome headless is an instance of chrome. You can't start from normal mode and switch to headless mid test. Once you start testing with any kind of browser mode, you need to stick to it. There are some work arounds I've not tried with opening windows with code and continuing from the new window.

Sign up to request clarification or add additional context in comments.

Comments

-1

Use phantomJSDriver for Headless automation

WebDriver driver = new PhantomJSDriver();

1 Comment

PhantomJS was deprecated almost three years ago in favor of headless chrome. And this is not what the OP asked anyway.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.