use of org.openqa.selenium.remote.Command in project flow by vaadin.
the class ChromeDeviceTest method setConnectionType.
/**
* Change network connection type in the browser.
*
* @param connectionType
* the new connection type
* @throws IOException
*/
protected void setConnectionType(NetworkConnection.ConnectionType connectionType) throws IOException {
RemoteWebDriver driver = (RemoteWebDriver) ((TestBenchDriverProxy) getDriver()).getWrappedDriver();
final Map<String, Integer> parameters = new HashMap<>();
parameters.put("type", connectionType.hashCode());
final Map<String, Object> connectionParams = new HashMap<>();
connectionParams.put("parameters", parameters);
Response response = driver.getCommandExecutor().execute(new Command(driver.getSessionId(), "setNetworkConnection", connectionParams));
if (response.getStatus() != 0) {
throw new RuntimeException("Unable to set connection type");
}
}
Aggregations