I am using Selenium and ChromeDriver to write a test to simulate network connection loss.
this.chromeDriver.setNetworkConnection(NetworkConnection.ConnectionType.AIRPLANE_MODE);
//wait and do actions
this.chromeDriver.setNetworkConnection(NetworkConnection.ConnectionType.WIFI);
//asserts
My tests run within a container, and currently I am casting an injected instance of a WebDriver that I know is Chrome as this.chromeDriver = (ChromeDriver)this.webDriver;
Looking online I do not see a way to turn off network connectivity through the WebDriver instance, and I would like to avoid turning off/on on host level just for the test. Is there a better way of achieving network simulation using Selenium in 3.6?