I am trying to run my application in headless mode using Chrome Browser, Selenium and Java. But it open a new chrome instance and start running the script in normal UI mode(can see the execution)
Is there anything wrong in code or browser compatibility.
OS - Windows 10, Chrome Version - 85.0.4183.121
Below is my code -
package XYZ;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class Test{
public static void main(String args[]) {
System.setProperty("webdriver.chrome.driver",
"C:\\Users\\TestUser\\Desktop\\SeleniumWorkspace\\ABC\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("headless");
options.addArguments("window-size=1400,800");
options.addArguments("disable-gpu")
//options.addArguments("--headless", "--disable-gpu", "--window-size=1400,800","--ignore-certificate-errors");
WebDriver driver = new ChromeDriver(options);
driver.get("https://www.google.com");
System.out.println(driver.getCurrentUrl());
}
}