Skip to content

Commit 346da0e

Browse files
dosasdosasAutomatedTester
authored
Added default executable path in service module for (#10057)
* chrome * edge * firefox * ie * safari * webkitgtk * wpewebkit Co-authored-by: dosas <dosas@github.com> Co-authored-by: David Burns <david.burns@theautomatedtester.co.uk>
1 parent 2a43011 commit 346da0e

File tree

15 files changed

+50
-23
lines changed

15 files changed

+50
-23
lines changed

py/selenium/webdriver/chrome/service.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@
1919
from selenium.webdriver.chromium import service
2020

2121

22+
DEFAULT_EXECUTEABLE_PATH = "chromedriver"
23+
24+
2225
class Service(service.ChromiumService):
2326
"""
2427
Object that manages the starting and stopping of the ChromeDriver
2528
"""
2629

27-
def __init__(self, executable_path: str, port: int = 0, service_args: List[str] = None,
30+
def __init__(self, executable_path: str = DEFAULT_EXECUTEABLE_PATH,
31+
port: int = 0, service_args: List[str] = None,
2832
log_path: str = None, env: str = None):
2933
"""
3034
Creates a new instance of the Service

py/selenium/webdriver/chrome/webdriver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import warnings
1818
from selenium.webdriver.chromium.webdriver import ChromiumDriver
1919
from .options import Options
20-
from .service import Service
20+
from .service import DEFAULT_EXECUTEABLE_PATH, Service
2121
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
2222

2323

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

36-
def __init__(self, executable_path="chromedriver", port=DEFAULT_PORT,
36+
def __init__(self, executable_path=DEFAULT_EXECUTEABLE_PATH, port=DEFAULT_PORT,
3737
options: Options = None, service_args=None,
3838
desired_capabilities=None, service_log_path=DEFAULT_SERVICE_LOG_PATH,
3939
chrome_options=None, service: Service = None, keep_alive=DEFAULT_KEEP_ALIVE):

py/selenium/webdriver/edge/service.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@
1919
from selenium.webdriver.chromium import service
2020

2121

22+
DEFAULT_EXECUTEABLE_PATH = 'msedgedriver'
23+
24+
2225
class Service(service.ChromiumService):
2326

24-
def __init__(self, executable_path: str, port: int = 0, verbose: bool = False, log_path: str = None,
27+
def __init__(self, executable_path: str = DEFAULT_EXECUTEABLE_PATH,
28+
port: int = 0, verbose: bool = False, log_path: str = None,
2529
service_args: List[str] = None, env=None):
2630
"""
2731
Creates a new instance of the EdgeDriver service.

py/selenium/webdriver/edge/webdriver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import warnings
1818
from selenium.webdriver.chromium.webdriver import ChromiumDriver
1919
from .options import Options
20-
from .service import Service
20+
from .service import DEFAULT_EXECUTEABLE_PATH, Service
2121
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
2222

2323

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

35-
def __init__(self, executable_path='msedgedriver', port=DEFAULT_PORT,
35+
def __init__(self, executable_path=DEFAULT_EXECUTEABLE_PATH, port=DEFAULT_PORT,
3636
options: Options = Options(), service_args=None,
3737
capabilities=None, service_log_path=DEFAULT_SERVICE_LOG_PATH,
3838
service: Service = None, keep_alive=False, verbose=False):

py/selenium/webdriver/firefox/service.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@
2020
from selenium.webdriver.common import (service, utils)
2121

2222

23+
DEFAULT_EXECUTABLE_PATH = "geckodriver"
24+
25+
2326
class Service(service.Service):
2427
"""Object that manages the starting and stopping of the
2528
GeckoDriver."""
2629

27-
def __init__(self, executable_path: str, port: int = 0, service_args: List[str] = None,
30+
def __init__(self, executable_path: str = DEFAULT_EXECUTABLE_PATH,
31+
port: int = 0, service_args: List[str] = None,
2832
log_path: str = "geckodriver.log", env: dict = None):
2933
"""Creates a new instance of the GeckoDriver remote service proxy.
3034

py/selenium/webdriver/firefox/webdriver.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@
2828
from .firefox_profile import FirefoxProfile
2929
from .options import Options
3030
from .remote_connection import FirefoxRemoteConnection
31-
from .service import Service
31+
from .service import DEFAULT_EXECUTABLE_PATH, Service
3232

3333

3434
# Default for log_path variable. To be deleted when deprecations for arguments are removed.
3535
DEFAULT_LOG_PATH = None
36-
DEFAULT_EXECUTABLE_PATH = "geckodriver"
3736
DEFAULT_SERVICE_LOG_PATH = "geckodriver.log"
3837

3938

py/selenium/webdriver/ie/service.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@
2020
from selenium.webdriver.common import service
2121

2222

23+
DEFAULT_EXECUTEABLE_PATH = 'IEDriverServer.exe'
24+
25+
2326
class Service(service.Service):
2427
"""
2528
Object that manages the starting and stopping of the IEDriver
2629
"""
2730

28-
def __init__(self, executable_path: str,
31+
def __init__(self, executable_path: str = DEFAULT_EXECUTEABLE_PATH,
2932
port: int = 0, host: str = None,
3033
log_level: str = None, log_file: str = None):
3134
"""

py/selenium/webdriver/ie/webdriver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import warnings
2020

2121
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
22-
from .service import Service
22+
from .service import DEFAULT_EXECUTEABLE_PATH, Service
2323
from .options import Options
2424
from selenium.webdriver.common import utils
2525

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

37-
def __init__(self, executable_path='IEDriverServer.exe', capabilities=None,
37+
def __init__(self, executable_path=DEFAULT_EXECUTEABLE_PATH, capabilities=None,
3838
port=DEFAULT_PORT, timeout=DEFAULT_TIMEOUT, host=DEFAULT_HOST,
3939
log_level=DEFAULT_LOG_LEVEL, service_log_path=DEFAULT_SERVICE_LOG_PATH,
4040
options: Options = None, service: Service = None,

py/selenium/webdriver/safari/service.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@
2020
from subprocess import PIPE
2121

2222

23+
DEFAULT_EXECUTABLE_PATH = "/usr/bin/safaridriver"
24+
25+
2326
class Service(service.Service):
2427
"""
2528
Object that manages the starting and stopping of the SafariDriver
2629
"""
2730

28-
def __init__(self, executable_path, port=0, quiet=False, service_args=None):
31+
def __init__(self, executable_path: str = DEFAULT_EXECUTABLE_PATH,
32+
port=0, quiet=False, service_args=None):
2933
"""
3034
Creates a new instance of the Service
3135

py/selenium/webdriver/safari/webdriver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
2525
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
2626
from .options import Options
27-
from .service import Service
27+
from .service import DEFAULT_EXECUTABLE_PATH, Service
2828
from .remote_connection import SafariRemoteConnection
2929

30-
DEFAULT_EXECUTABLE_PATH = "/usr/bin/safaridriver"
30+
3131
DEFAULT_SAFARI_CAPS = DesiredCapabilities.SAFARI.copy()
3232

3333

0 commit comments

Comments
 (0)