
Verifying Sortable Tables in Playwright JS
- Speakers
- Colby Fayock, Developer Advocate, Applitools
In today’s recipe, we’re going to run our test in headless mode.
What this means is that we’ll run the test without opening up the browser.
To do so, in our BaseTests.java file we need this ChromeOptions object, and we will instantiate it — ChromeOptions options = new ChromeOptions() .
Then we’re going to use this object to setHeadless(). Notice, this takes a Boolean value. So, if we want it to be headless, we put in “true”, otherwise we set it to “false”.
In our case, since we want to run headlessly, we will say — options.setHeadless(true).
Then we’re going to instantiate our actual driver. So, we’ll say — driver = new ChromeDriver() — and then I’m going to pass in that options object.
That’s all that’s needed to run our test in Chrome, but in headless mode.
I’m going to go ahead and run a test, just so that you can see it’ll run without actually opening the browser itself.
Voila, we’re done.
Here’s the code sample from our tutorial on how to execute your tests in headless mode in Selenium for Java