While Selenium can not prevent users from closing the browser, there are other ways you can achieve uninterrupted test execution.
Option 1: Use headless chrome
With chrome v60+ for windows, you can run chrome headless. This means the browser will not pop up on the screen so users will not be interrupted. It will however, still pop up the chrome icon on the toolbar. Clicking on this icon will not bring up the browser, but users can still right click and quit it. The other downside is you won't be able to watch tests run in real time anymore. If you want to use chrome headless, you just need to add chromeOptions
to your chromedriver initialization. Here's an example in java:
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
Webdriver driver = new ChromeDriver(chromeOptions);
Option 2: Setup Selenium Grid and run Selenium Standalone as a Service
If you don't want your user to even see the Chrome icon appear on the toolbar, then I would setup selenium grid and run the Selenium Standalone as a Windows Service (NSSM is a nice tool for this). This would run the test in Session 0 in the background where it is completely invisible to the user, hence will have no way of interrupting it. You can still see screenshots of any running tests by going to the selenium hub portal. The setup for this is more involved, but I would recommend this option for the long run for scalability. It will also fit very well if you intend to move towards Continuous Integration.