I'm thinking you have a proxy set in your OS. If no proxy environment variables are set, in a Windows environment, proxy settings are obtained from the registry’s Internet Settings section and in a Mac OS X environment, proxy information is retrieved from the OS X System Configuration Framework (
http://docs.python.org/2/library/urllib2.html#urllib2.ProxyHandler).
On my system (Windows 7), requests to 127.0.0.1 get redirected to the proxy if it is set in Internet Options, including the request to create a Selenium session.
One way to tell urllib2 not to use a proxy when the communication is local is to set the environmental variable no_proxy. There are several ways to do this
1) As a keyword call to a bundled library:
OperatingSystem.Set Environment Variable no_proxy 127.0.0.1
2) In some Python code used by the test data:
import os
os.environ['no_proxy'] = '127.0.0.1'
3) in the shell/script prior to lanuching RF:
set no_proxy=127.0.0.1
export if *nix...
Whatever way its done, it has to happen before Open Browser.
Kevin