Skip to content

Commit

Permalink
Added default executable path in service module for (#10057)
Browse files Browse the repository at this point in the history
* chrome
* edge
* firefox
* ie
* safari
* webkitgtk
* wpewebkit

Co-authored-by: dosas <dosas@github.com>
Co-authored-by: David Burns <david.burns@theautomatedtester.co.uk>
  • Loading branch information
3 people committed Nov 19, 2021
1 parent 2a43011 commit 346da0e
Show file tree
Hide file tree
Showing 15 changed files with 50 additions and 23 deletions.
6 changes: 5 additions & 1 deletion py/selenium/webdriver/chrome/service.py
Expand Up @@ -19,12 +19,16 @@
from selenium.webdriver.chromium import service


DEFAULT_EXECUTEABLE_PATH = "chromedriver"


class Service(service.ChromiumService):
"""
Object that manages the starting and stopping of the ChromeDriver
"""

def __init__(self, executable_path: str, port: int = 0, service_args: List[str] = None,
def __init__(self, executable_path: str = DEFAULT_EXECUTEABLE_PATH,
port: int = 0, service_args: List[str] = None,
log_path: str = None, env: str = None):
"""
Creates a new instance of the Service
Expand Down
4 changes: 2 additions & 2 deletions py/selenium/webdriver/chrome/webdriver.py
Expand Up @@ -17,7 +17,7 @@
import warnings
from selenium.webdriver.chromium.webdriver import ChromiumDriver
from .options import Options
from .service import Service
from .service import DEFAULT_EXECUTEABLE_PATH, Service
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities


Expand All @@ -33,7 +33,7 @@ class WebDriver(ChromiumDriver):
http://chromedriver.storage.googleapis.com/index.html
"""

def __init__(self, executable_path="chromedriver", port=DEFAULT_PORT,
def __init__(self, executable_path=DEFAULT_EXECUTEABLE_PATH, port=DEFAULT_PORT,
options: Options = None, service_args=None,
desired_capabilities=None, service_log_path=DEFAULT_SERVICE_LOG_PATH,
chrome_options=None, service: Service = None, keep_alive=DEFAULT_KEEP_ALIVE):
Expand Down
6 changes: 5 additions & 1 deletion py/selenium/webdriver/edge/service.py
Expand Up @@ -19,9 +19,13 @@
from selenium.webdriver.chromium import service


DEFAULT_EXECUTEABLE_PATH = 'msedgedriver'


class Service(service.ChromiumService):

def __init__(self, executable_path: str, port: int = 0, verbose: bool = False, log_path: str = None,
def __init__(self, executable_path: str = DEFAULT_EXECUTEABLE_PATH,
port: int = 0, verbose: bool = False, log_path: str = None,
service_args: List[str] = None, env=None):
"""
Creates a new instance of the EdgeDriver service.
Expand Down
4 changes: 2 additions & 2 deletions py/selenium/webdriver/edge/webdriver.py
Expand Up @@ -17,7 +17,7 @@
import warnings
from selenium.webdriver.chromium.webdriver import ChromiumDriver
from .options import Options
from .service import Service
from .service import DEFAULT_EXECUTEABLE_PATH, Service
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities


Expand All @@ -32,7 +32,7 @@ class WebDriver(ChromiumDriver):
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
"""

def __init__(self, executable_path='msedgedriver', port=DEFAULT_PORT,
def __init__(self, executable_path=DEFAULT_EXECUTEABLE_PATH, port=DEFAULT_PORT,
options: Options = Options(), service_args=None,
capabilities=None, service_log_path=DEFAULT_SERVICE_LOG_PATH,
service: Service = None, keep_alive=False, verbose=False):
Expand Down
6 changes: 5 additions & 1 deletion py/selenium/webdriver/firefox/service.py
Expand Up @@ -20,11 +20,15 @@
from selenium.webdriver.common import (service, utils)


DEFAULT_EXECUTABLE_PATH = "geckodriver"


class Service(service.Service):
"""Object that manages the starting and stopping of the
GeckoDriver."""

def __init__(self, executable_path: str, port: int = 0, service_args: List[str] = None,
def __init__(self, executable_path: str = DEFAULT_EXECUTABLE_PATH,
port: int = 0, service_args: List[str] = None,
log_path: str = "geckodriver.log", env: dict = None):
"""Creates a new instance of the GeckoDriver remote service proxy.
Expand Down
3 changes: 1 addition & 2 deletions py/selenium/webdriver/firefox/webdriver.py
Expand Up @@ -28,12 +28,11 @@
from .firefox_profile import FirefoxProfile
from .options import Options
from .remote_connection import FirefoxRemoteConnection
from .service import Service
from .service import DEFAULT_EXECUTABLE_PATH, Service


# Default for log_path variable. To be deleted when deprecations for arguments are removed.
DEFAULT_LOG_PATH = None
DEFAULT_EXECUTABLE_PATH = "geckodriver"
DEFAULT_SERVICE_LOG_PATH = "geckodriver.log"


Expand Down
5 changes: 4 additions & 1 deletion py/selenium/webdriver/ie/service.py
Expand Up @@ -20,12 +20,15 @@
from selenium.webdriver.common import service


DEFAULT_EXECUTEABLE_PATH = 'IEDriverServer.exe'


class Service(service.Service):
"""
Object that manages the starting and stopping of the IEDriver
"""

def __init__(self, executable_path: str,
def __init__(self, executable_path: str = DEFAULT_EXECUTEABLE_PATH,
port: int = 0, host: str = None,
log_level: str = None, log_file: str = None):
"""
Expand Down
4 changes: 2 additions & 2 deletions py/selenium/webdriver/ie/webdriver.py
Expand Up @@ -19,7 +19,7 @@
import warnings

from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from .service import Service
from .service import DEFAULT_EXECUTEABLE_PATH, Service
from .options import Options
from selenium.webdriver.common import utils

Expand All @@ -34,7 +34,7 @@
class WebDriver(RemoteWebDriver):
""" Controls the IEServerDriver and allows you to drive Internet Explorer """

def __init__(self, executable_path='IEDriverServer.exe', capabilities=None,
def __init__(self, executable_path=DEFAULT_EXECUTEABLE_PATH, capabilities=None,
port=DEFAULT_PORT, timeout=DEFAULT_TIMEOUT, host=DEFAULT_HOST,
log_level=DEFAULT_LOG_LEVEL, service_log_path=DEFAULT_SERVICE_LOG_PATH,
options: Options = None, service: Service = None,
Expand Down
6 changes: 5 additions & 1 deletion py/selenium/webdriver/safari/service.py
Expand Up @@ -20,12 +20,16 @@
from subprocess import PIPE


DEFAULT_EXECUTABLE_PATH = "/usr/bin/safaridriver"


class Service(service.Service):
"""
Object that manages the starting and stopping of the SafariDriver
"""

def __init__(self, executable_path, port=0, quiet=False, service_args=None):
def __init__(self, executable_path: str = DEFAULT_EXECUTABLE_PATH,
port=0, quiet=False, service_args=None):
"""
Creates a new instance of the Service
Expand Down
4 changes: 2 additions & 2 deletions py/selenium/webdriver/safari/webdriver.py
Expand Up @@ -24,10 +24,10 @@
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from .options import Options
from .service import Service
from .service import DEFAULT_EXECUTABLE_PATH, Service
from .remote_connection import SafariRemoteConnection

DEFAULT_EXECUTABLE_PATH = "/usr/bin/safaridriver"

DEFAULT_SAFARI_CAPS = DesiredCapabilities.SAFARI.copy()


Expand Down
6 changes: 5 additions & 1 deletion py/selenium/webdriver/webkitgtk/service.py
Expand Up @@ -18,12 +18,16 @@
from selenium.webdriver.common import service


DEFAULT_EXECUTABLE_PATH = "WebKitWebDriver"


class Service(service.Service):
"""
Object that manages the starting and stopping of the WebKitGTKDriver
"""

def __init__(self, executable_path, port=0, log_path=None):
def __init__(self, executable_path: str = DEFAULT_EXECUTABLE_PATH,
port=0, log_path=None):
"""
Creates a new instance of the Service
Expand Down
6 changes: 3 additions & 3 deletions py/selenium/webdriver/webkitgtk/webdriver.py
Expand Up @@ -19,7 +19,7 @@


from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from .service import Service
from .service import DEFAULT_EXECUTABLE_PATH, Service
from .options import Options


Expand All @@ -28,8 +28,8 @@ class WebDriver(RemoteWebDriver):
Controls the WebKitGTKDriver and allows you to drive the browser.
"""

def __init__(self, executable_path="WebKitWebDriver", port=0, options=None,
desired_capabilities=None,
def __init__(self, executable_path=DEFAULT_EXECUTABLE_PATH,
port=0, options=None, desired_capabilities=None,
service_log_path=None, keep_alive=False):
"""
Creates a new instance of the WebKitGTK driver.
Expand Down
6 changes: 5 additions & 1 deletion py/selenium/webdriver/wpewebkit/service.py
Expand Up @@ -18,12 +18,16 @@
from selenium.webdriver.common import service


DEFAULT_EXECUTEABLE_PATH = "WPEWebDriver"


class Service(service.Service):
"""
Object that manages the starting and stopping of the WPEWebKitDriver
"""

def __init__(self, executable_path, port=0, log_path=None):
def __init__(self, executable_path: str = DEFAULT_EXECUTEABLE_PATH,
port=0, log_path=None):
"""
Creates a new instance of the Service
Expand Down
5 changes: 3 additions & 2 deletions py/selenium/webdriver/wpewebkit/webdriver.py
Expand Up @@ -20,15 +20,16 @@

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from .service import Service
from .service import DEFAULT_EXECUTEABLE_PATH, Service


class WebDriver(RemoteWebDriver):
"""
Controls the WPEWebKitDriver and allows you to drive the browser.
"""

def __init__(self, executable_path="WPEWebDriver", port=0, options=None,
def __init__(self, executable_path=DEFAULT_EXECUTEABLE_PATH,
port=0, options=None,
desired_capabilities=DesiredCapabilities.WPEWEBKIT,
service_log_path=None):
"""
Expand Down
2 changes: 1 addition & 1 deletion py/test/selenium/webdriver/marionette/mn_service_tests.py
Expand Up @@ -19,7 +19,7 @@


def test_command_line_args():
service = Service("geckodriver", service_args=["--log", "trace"])
service = Service(service_args=["--log", "trace"])
found = False

args = service.command_line_args()
Expand Down

0 comments on commit 346da0e

Please sign in to comment.