Skip to content

Commit 5ca677d

Browse files
committed
Completed initial construct of service class
Although I have completed the intial implementation of the service class and it's usage, I have discovered unlike the selenium options most if not all of the attributes must be set on the instantiate of the class. So need to rework the parsing (should check signature instead of attributes) and then construct the class with these parameters.
1 parent da2004f commit 5ca677d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

atest/acceptance/browser_service.robot

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ Documentation These tests check the service argument of Open Browser.
66
*** Test Cases ***
77
Browser With Selenium Service As String
88
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
9-
... service=port=1234; executable_path = '/path/to/driver/executable'
9+
... service=port=1234; executable_path='/path/to/driver/executable'

src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class WebDriverCreator:
5858
def __init__(self, log_dir):
5959
self.log_dir = log_dir
6060
self.selenium_options = SeleniumOptions()
61-
#self.selenium_service = SeleniumService()
61+
self.selenium_service = SeleniumService()
6262

6363
def create_driver(
6464
self,
@@ -76,6 +76,7 @@ def create_driver(
7676
desired_capabilities = self._parse_capabilities(desired_capabilities, browser)
7777
service_log_path = self._get_log_path(service_log_path)
7878
options = self.selenium_options.create(self.browser_names.get(browser), options)
79+
service = self.selenium_service.create(self.browser_names.get(browser), service)
7980
if service_log_path:
8081
logger.info(f"Browser driver log file created to: {service_log_path}")
8182
self._create_directory(service_log_path)
@@ -160,7 +161,8 @@ def create_chrome(
160161
if not executable_path:
161162
executable_path = self._get_executable_path(webdriver.chrome.service.Service)
162163
log_method = self._get_log_method(ChromeService, service_log_path)
163-
service = ChromeService(executable_path=executable_path, **log_method)
164+
if not service:
165+
service = ChromeService(executable_path=executable_path, **log_method)
164166
return webdriver.Chrome(
165167
options=options,
166168
service=service,
@@ -573,7 +575,7 @@ def _split(self, service):
573575
if toknum == token.OP and tokval == ";":
574576
split_service.append(service[start_position : tokpos[1]].strip())
575577
start_position = tokpos[1] + 1
576-
split_service.append(options[start_position:])
578+
split_service.append(service[start_position:])
577579
return split_service
578580

579581
class SeleniumOptions:

0 commit comments

Comments
 (0)