diff --git a/py/selenium/webdriver/edge/webdriver.py b/py/selenium/webdriver/edge/webdriver.py index e78b14e021059..5171f71576556 100644 --- a/py/selenium/webdriver/edge/webdriver.py +++ b/py/selenium/webdriver/edge/webdriver.py @@ -14,6 +14,7 @@ # 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 @@ -25,12 +26,16 @@ class WebDriver(RemoteWebDriver): def __init__(self, executable_path='MicrosoftWebDriver.exe', - capabilities=None, port=0, verbose=False, log_path=None): + capabilities=None, port=0, verbose=False, service_log_path=None, log_path=None): + if log_path: + warnings.warn('use service_log_path instead of log_path', DeprecationWarning) + service_log_path = log_path + self.port = port if self.port == 0: self.port = utils.free_port() - self.edge_service = Service(executable_path, port=self.port, verbose=verbose, log_path=log_path) + self.edge_service = Service(executable_path, port=self.port, verbose=verbose, log_path=service_log_path) self.edge_service.start() if capabilities is None: diff --git a/py/selenium/webdriver/firefox/webdriver.py b/py/selenium/webdriver/firefox/webdriver.py index 8642b75dfba15..e56f0b24ecbd0 100644 --- a/py/selenium/webdriver/firefox/webdriver.py +++ b/py/selenium/webdriver/firefox/webdriver.py @@ -56,8 +56,8 @@ class WebDriver(RemoteWebDriver): def __init__(self, firefox_profile=None, firefox_binary=None, timeout=30, capabilities=None, proxy=None, executable_path="geckodriver", options=None, - log_path="geckodriver.log", firefox_options=None, - service_args=None, desired_capabilities=None): + service_log_path="geckodriver.log", firefox_options=None, + service_args=None, desired_capabilities=None, log_path=None): """Starts a new local session of Firefox. Based on the combination and specificity of the various keyword @@ -100,12 +100,15 @@ def __init__(self, firefox_profile=None, firefox_binary=None, binary to use for Firefox 47.0.1 and greater, which defaults to picking up the binary from the system path. :param options: Instance of ``options.Options``. - :param log_path: Where to log information from the driver. + :param service_log_path: Where to log information from the driver. :param desired_capabilities: alias of capabilities. In future versions of this library, this will replace 'capabilities'. This will make the signature consistent with RemoteWebDriver. """ + if log_path: + warnings.warn('use service_log_path instead of log_path', DeprecationWarning) + service_log_path = log_path if firefox_options: warnings.warn('use options instead of firefox_options', DeprecationWarning) options = firefox_options @@ -156,7 +159,7 @@ def __init__(self, firefox_profile=None, firefox_binary=None, self.service = Service( executable_path, service_args=service_args, - log_path=log_path) + log_path=service_log_path) self.service.start() capabilities.update(options.to_capabilities()) diff --git a/py/selenium/webdriver/ie/webdriver.py b/py/selenium/webdriver/ie/webdriver.py index 43483144b9748..caa36c4ee02ce 100644 --- a/py/selenium/webdriver/ie/webdriver.py +++ b/py/selenium/webdriver/ie/webdriver.py @@ -25,7 +25,7 @@ DEFAULT_PORT = 0 DEFAULT_HOST = None DEFAULT_LOG_LEVEL = None -DEFAULT_LOG_FILE = None +DEFAULT_SERVICE_LOG_PATH = None class WebDriver(RemoteWebDriver): @@ -33,8 +33,8 @@ class WebDriver(RemoteWebDriver): def __init__(self, executable_path='IEDriverServer.exe', capabilities=None, port=DEFAULT_PORT, timeout=DEFAULT_TIMEOUT, host=DEFAULT_HOST, - log_level=DEFAULT_LOG_LEVEL, log_file=DEFAULT_LOG_FILE, options=None, - ie_options=None, desired_capabilities=None): + log_level=DEFAULT_LOG_LEVEL, service_log_path=DEFAULT_SERVICE_LOG_PATH, options=None, + ie_options=None, desired_capabilities=None, log_file=None): """ Creates a new instance of the chrome driver. @@ -45,10 +45,13 @@ def __init__(self, executable_path='IEDriverServer.exe', capabilities=None, - capabilities: capabilities Dictionary object - port - port you would like the service to run, if left as 0, a free port will be found. - log_level - log level you would like the service to run. - - log_file - log file you would like the service to log to. + - service_log_path - target of logging of service, may be "stdout", "stderr" or file path. - options: IE Options instance, providing additional IE options - desired_capabilities: alias of capabilities; this will make the signature consistent with RemoteWebDriver. """ + if log_file: + warnings.warn('use service_log_path instead of log_file', DeprecationWarning) + service_log_path = log_file if ie_options: warnings.warn('use options instead of ie_options', DeprecationWarning) options = ie_options @@ -56,8 +59,6 @@ def __init__(self, executable_path='IEDriverServer.exe', capabilities=None, if self.port == 0: self.port = utils.free_port() self.host = host - self.log_level = log_level - self.log_file = log_file # If both capabilities and desired capabilities are set, ignore desired capabilities. if capabilities is None and desired_capabilities: @@ -77,8 +78,8 @@ def __init__(self, executable_path='IEDriverServer.exe', capabilities=None, executable_path, port=self.port, host=self.host, - log_level=self.log_level, - log_file=self.log_file) + log_level=log_level, + log_file=service_log_path) self.iedriver.start() diff --git a/py/test/selenium/webdriver/firefox/ff_launcher_tests.py b/py/test/selenium/webdriver/firefox/ff_launcher_tests.py index 3c73935c0a7d6..23d53894992d9 100644 --- a/py/test/selenium/webdriver/firefox/ff_launcher_tests.py +++ b/py/test/selenium/webdriver/firefox/ff_launcher_tests.py @@ -27,11 +27,11 @@ def test_we_can_launch_multiple_firefox_instances(capabilities): driver3.quit() -def test_launch_firefox_with_none_log_path(capabilities): - driver = Firefox(capabilities=capabilities, log_path=None) +def test_launch_firefox_with_none_service_log_path(capabilities): + driver = Firefox(capabilities=capabilities, service_log_path=None) driver.quit() -def test_launch_firefox_with_empty_string_log_path(capabilities): - driver = Firefox(capabilities=capabilities, log_path="") +def test_launch_firefox_with_empty_string_service_log_path(capabilities): + driver = Firefox(capabilities=capabilities, service_log_path="") driver.quit() diff --git a/py/test/selenium/webdriver/marionette/mn_launcher_tests.py b/py/test/selenium/webdriver/marionette/mn_launcher_tests.py index 221f4fa025e00..e81f0258fd274 100644 --- a/py/test/selenium/webdriver/marionette/mn_launcher_tests.py +++ b/py/test/selenium/webdriver/marionette/mn_launcher_tests.py @@ -31,11 +31,11 @@ def test_we_can_launch_multiple_firefox_instances(capabilities): driver3.quit() -def test_launch_firefox_with_none_log_path(capabilities): - driver = Firefox(capabilities=capabilities, log_path=None) +def test_launch_firefox_with_none_service_log_path(capabilities): + driver = Firefox(capabilities=capabilities, service_log_path=None) driver.quit() -def test_launch_firefox_with_empty_string_log_path(capabilities): - driver = Firefox(capabilities=capabilities, log_path="") +def test_launch_firefox_with_empty_string_service_log_path(capabilities): + driver = Firefox(capabilities=capabilities, service_log_path="") driver.quit()