DavidBurns moving proxy setting code to the driver to be handled in capabilities and deprecating the Firefox Profile approach
git-svn-id: http://selenium.googlecode.com/svn/trunk/py@17827 07704840-8298-11de-bf8c-fd130f914ac9
diff --git a/selenium/webdriver/firefox/firefox_profile.py b/selenium/webdriver/firefox/firefox_profile.py
index 1b3ae9a..7c05748 100644
--- a/selenium/webdriver/firefox/firefox_profile.py
+++ b/selenium/webdriver/firefox/firefox_profile.py
@@ -211,6 +211,9 @@
return base64.encodestring(fp.getvalue())
def set_proxy(self, proxy):
+ import warnings
+ warnings.warn("This method has been deprecated. Please pass in the proxy object to the Driver Object",
+ DeprecationWarning)
if proxy is None:
raise ValueError("proxy can not be None")
diff --git a/selenium/webdriver/firefox/webdriver.py b/selenium/webdriver/firefox/webdriver.py
index 25f725e..680a15d 100644
--- a/selenium/webdriver/firefox/webdriver.py
+++ b/selenium/webdriver/firefox/webdriver.py
@@ -33,7 +33,8 @@
# There is no native event support on Mac
NATIVE_EVENTS_ALLOWED = sys.platform != "darwin"
- def __init__(self, firefox_profile=None, firefox_binary=None, timeout=30):
+ def __init__(self, firefox_profile=None, firefox_binary=None, timeout=30,
+ capabilities=None, proxy=None):
self.binary = firefox_binary
self.profile = firefox_profile
@@ -46,10 +47,17 @@
if self.binary is None:
self.binary = FirefoxBinary()
+ if capabilities is None:
+ capabilities = DesiredCapabilities.FIREFOX
+
+ if proxy is not None:
+ proxy.add_to_capabilities(capabilities)
+
+
RemoteWebDriver.__init__(self,
command_executor=ExtensionConnection("127.0.0.1", self.profile,
self.binary, timeout),
- desired_capabilities=DesiredCapabilities.FIREFOX)
+ desired_capabilities=capabilities)
def create_web_element(self, element_id):
"""Override from RemoteWebDriver to use firefox.WebElement."""