Testing with a selenium driver in Java without opening any browser

后端 未结 4 1525
暖寄归人
暖寄归人 2020-12-17 00:40

I need to test with selenium chrome driver in Java. But chrome window should\'t be opened. Assume this a product and no window should be opened.

I\'ve also looked at

4条回答
  •  再見小時候
    2020-12-17 01:08

    In selenium web driver there is headless mode. so in headless mode you can do the automation without opening the web browser. and also you can deploy your application in none gui system

        ChromeOptions options = new ChromeOptions();
        // setting headless mode to true.. so there isn't any ui
        options.setHeadless(true);
    
        // Create a new instance of the Chrome driver
        WebDriver driver = new ChromeDriver(options);
    

提交回复
热议问题