Skip to content

Commit 9bd41c1

Browse files
authored
Increase minimum required Selenium to 3.8.1 (robotframework#1325)
Increase minimum required Selenium to 3.8.1 Fixes robotframework#1305
1 parent b70e51a commit 9bd41c1

2 files changed

Lines changed: 14 additions & 28 deletions

File tree

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
selenium >= 3.4.0
2-
robotframework >= 2.8.7
1+
selenium >= 3.8.1
2+
robotframework >= 3.0.4

src/SeleniumLibrary/keywords/webdrivertools.py

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from robot.utils import ConnectionCache
2121
from selenium import webdriver
2222

23-
from SeleniumLibrary.utils import is_falsy, is_truthy, SELENIUM_VERSION
23+
from SeleniumLibrary.utils import is_falsy, is_truthy
2424

2525

2626
class WebDriverCreator(object):
@@ -86,16 +86,12 @@ def create_chrome(self, desired_capabilities, remote_url, options=None):
8686
if not desired_capabilities:
8787
desired_capabilities = {'desired_capabilities': webdriver.DesiredCapabilities.CHROME.copy()}
8888
return self._remote(desired_capabilities, remote_url, options=options)
89-
if SELENIUM_VERSION.major >= 3 and SELENIUM_VERSION.minor >= 8:
90-
return webdriver.Chrome(options=options, **desired_capabilities)
91-
return webdriver.Chrome(**desired_capabilities)
89+
return webdriver.Chrome(options=options, **desired_capabilities)
9290

9391
def create_headless_chrome(self, desired_capabilities, remote_url):
94-
if SELENIUM_VERSION.major >= 3 and SELENIUM_VERSION.minor >= 8:
95-
options = webdriver.ChromeOptions()
96-
options.set_headless()
97-
else:
98-
options = None
92+
options = webdriver.ChromeOptions()
93+
# Can be changed to options.headless = True when minimum Selenium version is 3.12.0 or greater.
94+
options.set_headless()
9995
return self.create_chrome(desired_capabilities, remote_url, options)
10096

10197
def create_firefox(self, desired_capabilities, remote_url, ff_profile_dir,
@@ -107,10 +103,7 @@ def create_firefox(self, desired_capabilities, remote_url, ff_profile_dir,
107103
return self._remote(desired_capabilities, remote_url,
108104
profile, options)
109105
desired_capabilities.update(self._geckodriver_log)
110-
if SELENIUM_VERSION.major >= 3 and SELENIUM_VERSION.minor >= 8:
111-
return webdriver.Firefox(options=options, firefox_profile=profile,
112-
**desired_capabilities)
113-
return webdriver.Firefox(firefox_profile=profile,
106+
return webdriver.Firefox(options=options, firefox_profile=profile,
114107
**desired_capabilities)
115108

116109
def _get_ff_profile(self, ff_profile_dir):
@@ -120,17 +113,13 @@ def _get_ff_profile(self, ff_profile_dir):
120113

121114
@property
122115
def _geckodriver_log(self):
123-
if SELENIUM_VERSION.major >= 3:
124-
return {'log_path': os.path.join(self.log_dir, 'geckodriver.log')}
125-
return {}
116+
return {'log_path': os.path.join(self.log_dir, 'geckodriver.log')}
126117

127118
def create_headless_firefox(self, desired_capabilities, remote_url,
128119
ff_profile_dir):
129-
if SELENIUM_VERSION.major >= 3 and SELENIUM_VERSION.minor >= 8:
130-
options = webdriver.FirefoxOptions()
131-
options.set_headless()
132-
else:
133-
options = None
120+
options = webdriver.FirefoxOptions()
121+
# Can be changed to options.headless = True when minimum Selenium version is 3.12.0 or greater.
122+
options.set_headless()
134123
return self.create_firefox(desired_capabilities, remote_url,
135124
ff_profile_dir, options)
136125

@@ -201,12 +190,9 @@ def _remote(self, desired_capabilities, remote_url,
201190
remote_url = str(remote_url)
202191
if 'capabilities' in desired_capabilities:
203192
desired_capabilities['desired_capabilities'] = desired_capabilities.pop('capabilities')
204-
if SELENIUM_VERSION.major >= 3 and SELENIUM_VERSION.minor >= 8:
205-
return webdriver.Remote(command_executor=remote_url,
206-
browser_profile=profile_dir, options=options,
207-
**desired_capabilities)
193+
208194
return webdriver.Remote(command_executor=remote_url,
209-
browser_profile=profile_dir,
195+
browser_profile=profile_dir, options=options,
210196
**desired_capabilities)
211197

212198

0 commit comments

Comments
 (0)