Proxy Issues

Cannot connect to internet when Sahi is not running

symptom After installing Sahi, I cannot connect to the internet from any browser when Sahi is not running.

Even though Sahi is not running, all browsers show that proxy settings have been set to point to Sahi's proxy.
cause To understand why this may be happening, some background information is in order.

Sahi needs to change system/browser proxy settings in order to work with browsers. This lets Sahi inject Sahi script in web pages that in turn allows Sahi to record and playback scripts on the page.

Sahi reverts the proxy settings when it closes.

But there may be some scenarios when this does not happen.

Before looking at these scenarios, let us see how IE, FireFox and Chrome differ in the proxy behavior.

Firefox and Chrome

When a Firefox or Chrome browser is opened from the Sahi Dashboard, it is opened in a separate profile. Proxy settings are changed only for that profile. What this means is that if you were to open a Firefox, Chrome or IE browser outside of the Sahi Dashboard at the same time, they will NOT go through the Sahi proxy. Thus a user will be able to access the internet directly from the latter browser session(s) like he/she normally does.

IE is different

When an IE browser is opened from the dashboard, the system proxy settings are modified to go through Sahi.
  • If you were to open an IE browser from outside the Sahi dashboard at the same time, it will go through the Sahi proxy since the system proxy has been modified.
  • If you were to open a Chrome browser from outside the Sahi dashboard at the same time, it will go through the Sahi proxy since Chrome uses the system proxy settings.
  • If you were to open a Firefox browser from outside the Sahi dashboard at the same time, it will go through the Sahi proxy if it is configured to use the system proxy settings.
For all such browsers that go through the Sahi proxy, the user may see some anamolous behavior. So if you wish to browse the internet, do so after closing the Sahi IE window.

Why am I unable to connect to the internet despite closing Sahi?

You can get into the above problem by doing the following steps in order.
  1. Start the Sahi server.
  2. Then launch an IE browser from the Sahi Dashboard and navigate to your application.
  3. Instead of closing the IE browser, close Sahi in either of these ways
    • Do Ctrl + C on the Sahi server command window
    • Or simply close it by pressing the Close (x) button on the Sahi server command window (not on the Sahi Dashboard).
Explanation

The system proxy settings are reverted under the following circumstances.
  • When the last IE browser window launched from Sahi (Dashboard, Testrunner, Ant etc) is closed.
  • When the Sahi Dashboard is closed (by clicking the Close(x) button on the Sahi Dashboard).
In the case described above, since the IE window was not closed, the proxy settings were not reverted. Also the user did not close the Sahi Dashboard but instead closed the Sahi server command window. Even if the IE window was closed after this, the proxy settings will not be reset.

Effect

Since the system proxy settings were not reverted, any browser using the system proxy settings will NOT be able to connect to the internet unless Sahi is running.
resolution We need to revert the system proxy settings.

You can do any of the following to achieve this.
  • Launch Sahi, open an IE browser, close the IE browser
  • Launch Sahi and close it by clicking the Close(x) button on the Sahi Dashboard.
  • Launch Sahi and click System Proxy Off from the Sahi Dashboard. This is the least recommended solution, since you should never toggle the System Proxy from the Dashboard under normal circumstances.