1

My test script uses Selenium WebDriver with BrowserMob proxy server to simulate slow connection. Starting of the Internet Explorer WebDriver with BrowserMob proxy turns on system proxy. It affects to all connections to the internet (eclipse plugins update, mail corresponding and other apps). Therefore I need to disable system proxy at the end of test script. How to do this from java?

Note: stopping of BrowserMob proxy server doesn't disable system proxy settings.

beluha
  • 113
  • 1
  • 6

1 Answers1

1

I found solution in Internet Explorer WebDriver. There is need to start web driver with IE specific desired capabilities like this:

BrowserMobProxy server = new BrowserMobProxyServer();
server.start();

Proxy proxy = ClientUtil.createSeleniumProxy(server);

DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.IE_USE_PRE_PROCESS_PROXY, true);
capabilities.setCapability(CapabilityType.PROXY, proxy);

WebDriver driver = new InternetExplorerDriver(capabilities);

More info here https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities

beluha
  • 113
  • 1
  • 6