Search code examples
javawebbrowser-controlkioskincognito-mode

Automatically open browser full screen(kiosk & incognito mode) in java


I want to automatically open a browser with an URL in java. The browser should open in full-screen ( --kiosk) mode and --incognito mode together.
Currently, I am using following code to automatically open a browser. if(Desktop.isDesktopSupported()){ Desktop.getDesktop().browse(new URI("http://www.google.com")); }

Note: I am not using selenium webdriver. How could I fix such issue? Thanks in advance.


Solution

  • Got a solution without selenium web driver.

    String cmd = "chromium-browser --incognito --kiosk http://example.com/";
    Runtime run = Rintime.getRuntime();
    Process pr = run.exec(cmd);
    pr.waitFor();