Skip to content

Commit

Permalink
[py] remove all deprecated methods and args from Python bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
cgoldberg authored and AutomatedTester committed Jan 7, 2019
1 parent 2490b5f commit d25b01e
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 126 deletions.
3 changes: 0 additions & 3 deletions py/selenium/webdriver/chrome/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import warnings

from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from .remote_connection import ChromeRemoteConnection
from .service import Service
Expand Down Expand Up @@ -47,7 +45,6 @@ def __init__(self, executable_path="chromedriver", port=0,
- desired_capabilities - Dictionary object with non-browser specific
capabilities only, such as "proxy" or "loggingPref".
- service_log_path - Where to log information from the driver.
- chrome_options - Deprecated argument for options
- keep_alive - Whether to configure ChromeRemoteConnection to use HTTP keep-alive.
"""
if chrome_options:
Expand Down
8 changes: 0 additions & 8 deletions py/selenium/webdriver/edge/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import warnings

from selenium.webdriver.common import utils
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from selenium.webdriver.remote.remote_connection import RemoteConnection
Expand All @@ -40,14 +38,8 @@ def __init__(self, executable_path='MicrosoftWebDriver.exe',
- port - port you would like the service to run, if left as 0, a free port will be found.
- verbose - whether to set verbose logging in the service
- service_log_path - Where to log information from the driver.
- log_path: Deprecated argument for service_log_path
- keep_alive - Whether to configure ChromeRemoteConnection to use HTTP keep-alive.
"""
if log_path:
warnings.warn('use service_log_path instead of log_path',
DeprecationWarning, stacklevel=2)
service_log_path = log_path

self.port = port
if self.port == 0:
self.port = utils.free_port()
Expand Down
32 changes: 0 additions & 32 deletions py/selenium/webdriver/firefox/firefox_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,38 +181,6 @@ def encoded(self):
zipped.close()
return base64.b64encode(fp.getvalue()).decode('UTF-8')

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, stacklevel=2)
if proxy is None:
raise ValueError("proxy can not be None")

if proxy.proxy_type is ProxyType.UNSPECIFIED:
return

self.set_preference("network.proxy.type", proxy.proxy_type['ff_value'])

if proxy.proxy_type is ProxyType.MANUAL:
self.set_preference("network.proxy.no_proxies_on", proxy.no_proxy)
self._set_manual_proxy_preference("ftp", proxy.ftp_proxy)
self._set_manual_proxy_preference("http", proxy.http_proxy)
self._set_manual_proxy_preference("ssl", proxy.ssl_proxy)
self._set_manual_proxy_preference("socks", proxy.socks_proxy)
elif proxy.proxy_type is ProxyType.PAC:
self.set_preference("network.proxy.autoconfig_url", proxy.proxy_autoconfig_url)

def _set_manual_proxy_preference(self, key, setting):
if setting is None or setting is '':
return

host_details = setting.split(":")
self.set_preference("network.proxy.%s" % key, host_details[0])
if len(host_details) > 1:
self.set_preference("network.proxy.%s_port" % key, int(host_details[1]))

def _create_tempfolder(self):
"""
Creates a temp folder to store User.js and the extension
Expand Down
8 changes: 0 additions & 8 deletions py/selenium/webdriver/firefox/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import warnings

from selenium.common.exceptions import InvalidArgumentException
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common.proxy import Proxy
Expand Down Expand Up @@ -133,12 +131,6 @@ def headless(self, value):
elif '-headless' in self._arguments:
self._arguments.remove('-headless')

def set_headless(self, headless=True):
""" Deprecated, options.headless = True """
warnings.warn('use setter for headless property instead of set_headless',
DeprecationWarning, stacklevel=2)
self.headless = headless

def to_capabilities(self):
"""Marshals the Firefox options to a `moz:firefoxOptions`
object.
Expand Down
14 changes: 1 addition & 13 deletions py/selenium/webdriver/firefox/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import warnings

try:
basestring
except NameError: # Python 3.x
Expand Down Expand Up @@ -76,7 +74,7 @@ def __init__(self, firefox_profile=None, firefox_binary=None,
In this case that would be `firefox_profile`. This will result in
`options.profile` to be ignored because it is considered
a less specific setting than the top-level `firefox_profile`
keyword argument. Similarily, if you had specified a
keyword argument. Similarly, if you had specified a
`capabilities["moz:firefoxOptions"]["profile"]` Base64 string,
this would rank below `options.profile`.
Expand All @@ -96,23 +94,13 @@ def __init__(self, firefox_profile=None, firefox_binary=None,
defaults to picking up the binary from the system path.
:param options: Instance of ``options.Options``.
:param service_log_path: Where to log information from the driver.
:param firefox_options: Deprecated argument for options
:param service_args: List of args to pass to the driver service
:param desired_capabilities: alias of capabilities. In future
versions of this library, this will replace 'capabilities'.
This will make the signature consistent with RemoteWebDriver.
:param log_path: Deprecated argument for service_log_path
:param keep_alive: Whether to configure remote_connection.RemoteConnection to use
HTTP keep-alive.
"""
if log_path:
warnings.warn('use service_log_path instead of log_path',
DeprecationWarning, stacklevel=2)
service_log_path = log_path
if firefox_options:
warnings.warn('use options instead of firefox_options',
DeprecationWarning, stacklevel=2)
options = firefox_options
self.binary = None
self.profile = None
self.service = None
Expand Down
12 changes: 0 additions & 12 deletions py/selenium/webdriver/ie/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import warnings

from selenium.webdriver.common import utils
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from .service import Service
Expand Down Expand Up @@ -49,19 +47,9 @@ def __init__(self, executable_path='IEDriverServer.exe', capabilities=None,
- log_level - log level you would like the service to run.
- service_log_path - target of logging of service, may be "stdout", "stderr" or file path.
- options - IE Options instance, providing additional IE options
- ie_options - Deprecated argument for options
- desired_capabilities - alias of capabilities; this will make the signature consistent with RemoteWebDriver.
- log_file - Deprecated argument for service_log_path
- keep_alive - Whether to configure RemoteConnection to use HTTP keep-alive.
"""
if log_file:
warnings.warn('use service_log_path instead of log_file',
DeprecationWarning, stacklevel=2)
service_log_path = log_file
if ie_options:
warnings.warn('use options instead of ie_options',
DeprecationWarning, stacklevel=2)
options = ie_options
self.port = port
if self.port == 0:
self.port = utils.free_port()
Expand Down
6 changes: 0 additions & 6 deletions py/selenium/webdriver/opera/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,8 @@ def __init__(self, executable_path=None, port=0,
- service_args - List of args to pass to the driver service
- desired_capabilities: Dictionary object with non-browser specific
- service_log_path - Where to log information from the driver.
- opera_options - Deprecated argument for options
capabilities only, such as "proxy" or "loggingPref".
"""
if opera_options:
warnings.warn('use options instead of opera_options',
DeprecationWarning, stacklevel=2)
options = opera_options

executable_path = (executable_path if executable_path is not None
else "operadriver")
ChromiumDriver.__init__(self,
Expand Down
44 changes: 0 additions & 44 deletions py/selenium/webdriver/remote/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import base64
import copy
import warnings
from contextlib import contextmanager

from .command import Command
Expand Down Expand Up @@ -140,10 +139,6 @@ def __init__(self, command_executor='http://127.0.0.1:4444/wd/hub',
raise WebDriverException("Desired Capabilities must be a dictionary")
else:
capabilities.update(desired_capabilities)
if proxy is not None:
warnings.warn("Please use FirefoxOptions to set proxy",
DeprecationWarning, stacklevel=2)
proxy.add_to_capabilities(capabilities)
self.command_executor = command_executor
if type(self.command_executor) is bytes or isinstance(self.command_executor, str):
self.command_executor = RemoteConnection(command_executor, keep_alive=keep_alive)
Expand All @@ -152,9 +147,6 @@ def __init__(self, command_executor='http://127.0.0.1:4444/wd/hub',
self.capabilities = {}
self.error_handler = ErrorHandler()
self.start_client()
if browser_profile is not None:
warnings.warn("Please use FirefoxOptions to set browser profile",
DeprecationWarning, stacklevel=2)
self.start_session(capabilities, browser_profile)
self._switch_to = SwitchTo(self)
self._mobile = Mobile(self)
Expand Down Expand Up @@ -767,42 +759,6 @@ def switch_to(self):
"""
return self._switch_to

# Target Locators
def switch_to_active_element(self):
""" Deprecated use driver.switch_to.active_element
"""
warnings.warn("use driver.switch_to.active_element instead",
DeprecationWarning, stacklevel=2)
return self._switch_to.active_element

def switch_to_window(self, window_name):
""" Deprecated use driver.switch_to.window
"""
warnings.warn("use driver.switch_to.window instead",
DeprecationWarning, stacklevel=2)
self._switch_to.window(window_name)

def switch_to_frame(self, frame_reference):
""" Deprecated use driver.switch_to.frame
"""
warnings.warn("use driver.switch_to.frame instead",
DeprecationWarning, stacklevel=2)
self._switch_to.frame(frame_reference)

def switch_to_default_content(self):
""" Deprecated use driver.switch_to.default_content
"""
warnings.warn("use driver.switch_to.default_content instead",
DeprecationWarning, stacklevel=2)
self._switch_to.default_content()

def switch_to_alert(self):
""" Deprecated use driver.switch_to.alert
"""
warnings.warn("use driver.switch_to.alert instead",
DeprecationWarning, stacklevel=2)
return self._switch_to.alert

# Navigation
def back(self):
"""
Expand Down

1 comment on commit d25b01e

@barancev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have removed warnings and documentation for deprecated arguments, but not the arguments themselves. Why?

Please sign in to comment.