Skip to content

Commit 83b7d2c

Browse files
authored
Merge pull request #372 from seleniumbase/webdriver-updates
Webdriver updates
2 parents ec741c2 + f240e31 commit 83b7d2c

File tree

5 files changed

+70
-28
lines changed

5 files changed

+70
-28
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/SeleniumBaseText_F.png" title="SeleniumBase" height="38">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)<br />
2-
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/sb_media_logo.png" title="SeleniumBase" height="128">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
1+
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/SB_Logo3g2.png" title="SeleniumBase" height="47">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)<br />
2+
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/sb_media_logo_2.png" title="SeleniumBase" height="127">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
33

44
[<img src="https://img.shields.io/github/release/seleniumbase/SeleniumBase.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/releases) [<img src="https://dev.azure.com/seleniumbase/seleniumbase/_apis/build/status/seleniumbase.SeleniumBase?branchName=master" alt=" " />](https://dev.azure.com/seleniumbase/seleniumbase/_build/latest?definitionId=1&branchName=master) [<img src="https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master" alt=" " />](https://travis-ci.org/seleniumbase/SeleniumBase) [<img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt=" " />](https://gitter.im/seleniumbase/SeleniumBase) [<img src="https://img.shields.io/badge/license-MIT-22BBCC.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE) [<img src="https://img.shields.io/github/stars/seleniumbase/seleniumbase.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/stargazers) [<img src="https://img.shields.io/github/repo-size/seleniumbase/seleniumbase.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/releases)<br />
55

help_docs/method_summary.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
### SeleniumBase method summary
1+
### [<img src="https://cdn2.hubspot.net/hubfs/100006/images/SeleniumBaseText_F.png" title="SeleniumBase" height="22">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md) Method Summary
22

33
Here's a summary of SeleniumBase method definitions, which are defined in [base_case.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py)
44

5-
In order to maintain backwards compatibility with scripts using earlier verions of SeleniumBase, some methods that had their names shortened can also be called by their original method name. *(Ex: wait_for_element_visible was later shortened to wait_for_element and then to find_element, but the longer method names remained to keep older scripts from failing.)*
5+
For backwards compatibility, older versions of method names have remained to keep old scripts working. *(Ex: wait_for_element_visible was later shortened to wait_for_element and then to find_element.)*
66

77
```python
88
self.open(url)

seleniumbase/console_scripts/sb_install.py

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
urllib3.disable_warnings()
3535
DRIVER_DIR = os.path.dirname(os.path.realpath(drivers.__file__))
3636
DEFAULT_CHROMEDRIVER_VERSION = "2.44"
37-
DEFAULT_EDGEDRIVER_VERSION = "78.0.268.0"
37+
DEFAULT_GECKODRIVER_VERSION = "v0.24.0"
38+
DEFAULT_EDGEDRIVER_VERSION = "77.0.235.20"
39+
DEFAULT_OPERADRIVER_VERSION = "v.2.40"
3840

3941

4042
def invalid_run_command():
@@ -124,7 +126,7 @@ def main():
124126
else:
125127
raise Exception("Could not find Chromedriver to download!\n")
126128
elif name == "geckodriver" or name == "firefoxdriver":
127-
use_version = "v0.24.0"
129+
use_version = DEFAULT_GECKODRIVER_VERSION
128130
if "darwin" in sys_plat:
129131
file_name = "geckodriver-%s-macos.tar.gz" % use_version
130132
elif "linux" in sys_plat:
@@ -142,7 +144,7 @@ def main():
142144
download_url = ("https://github.com/mozilla/geckodriver/"
143145
"releases/download/"
144146
"%s/%s" % (use_version, file_name))
145-
elif name == "edgedriver" or name == "microsoftwebdriver":
147+
elif name == "edgedriver" or name == "msedgedriver":
146148
name = "edgedriver"
147149
use_version = DEFAULT_EDGEDRIVER_VERSION
148150
if num_args == 4:
@@ -175,7 +177,7 @@ def main():
175177
"%s/%s" % (major_version, file_name))
176178
elif name == "operadriver" or name == "operachromiumdriver":
177179
name = "operadriver"
178-
use_version = "v.2.40"
180+
use_version = DEFAULT_OPERADRIVER_VERSION
179181
if "darwin" in sys_plat:
180182
file_name = "operadriver_mac64.zip"
181183
platform_code = "mac64"
@@ -235,7 +237,7 @@ def main():
235237
if name == "operadriver":
236238
raise Exception("Zip file for OperaDriver is missing content!")
237239
for f_name in contents:
238-
# remove existing version if exists
240+
# Remove existing version if exists
239241
new_file = downloads_folder + '/' + str(f_name)
240242
if "Driver" in new_file or "driver" in new_file:
241243
if os.path.exists(new_file):
@@ -258,6 +260,52 @@ def main():
258260
print("Location of [%s %s]:\n%s" % (
259261
f_name, use_version, new_file))
260262
print("")
263+
elif name == "edgedriver" or name == "msedgedriver":
264+
if "darwin" in sys_plat or "linux" in sys_plat:
265+
raise Exception("Unexpected file format for msedgedriver!")
266+
expected_contents = (['Driver_Notes/',
267+
'Driver_Notes/credits.html',
268+
'Driver_Notes/LICENSE',
269+
'msedgedriver.exe'])
270+
if len(contents) != 4:
271+
raise Exception("Unexpected content in EdgeDriver Zip file!")
272+
# Zip file is valid. Proceed.
273+
driver_path = None
274+
driver_file = None
275+
for f_name in contents:
276+
print(f_name)
277+
# Remove existing version if exists
278+
str_name = str(f_name)
279+
new_file = downloads_folder + '/' + str_name
280+
if str_name == "msedgedriver.exe":
281+
driver_file = str_name
282+
driver_path = new_file
283+
if os.path.exists(new_file):
284+
os.remove(new_file)
285+
if not driver_file or not driver_path:
286+
raise Exception("Operadriver missing from Zip file!")
287+
print('Extracting %s from %s ...' % (contents, file_name))
288+
zip_ref.extractall(downloads_folder)
289+
zip_ref.close()
290+
os.remove(zip_file_path)
291+
print('Unzip Complete!\n')
292+
to_remove = (['%s/Driver_Notes/credits.html' % downloads_folder,
293+
'%s/Driver_Notes/LICENSE' % downloads_folder])
294+
for file_to_remove in to_remove:
295+
if os.path.exists(file_to_remove):
296+
os.remove(file_to_remove)
297+
if os.path.exists(downloads_folder + '/' + "Driver_Notes/"):
298+
# Only works if the directory is empty
299+
os.rmdir(downloads_folder + '/' + "Driver_Notes/")
300+
print("The file [%s] was saved to:\n%s\n" % (
301+
driver_file, driver_path))
302+
print("Making [%s] executable ..." % driver_file)
303+
make_executable(driver_path)
304+
print("[%s] is now ready for use!\n" % driver_file)
305+
print("Add folder path of Edge to System Environmental Variables!")
306+
print("\nLocation of [%s %s]:\n%s" % (
307+
driver_file, use_version, driver_path))
308+
print("")
261309
elif name == "operadriver":
262310
if len(contents) != 3:
263311
raise Exception("Unexpected content in OperaDriver Zip file!")
@@ -267,7 +315,7 @@ def main():
267315
driver_path = None
268316
driver_file = None
269317
for f_name in contents:
270-
# remove existing version if exists
318+
# Remove existing version if exists
271319
str_name = str(f_name).split(inner_folder)[1]
272320
new_file = downloads_folder + '/' + str_name
273321
if str_name == "operadriver" or str_name == "operadriver.exe":
@@ -292,13 +340,13 @@ def main():
292340
print("[%s] is now ready for use!\n" % driver_file)
293341
print("Location of [%s %s]:\n%s" % (
294342
driver_file, use_version, driver_path))
295-
# clean up extra files
343+
# Clean up extra files
296344
if os.path.exists(inner_driver):
297345
os.remove(inner_driver)
298346
if os.path.exists(inner_sha):
299347
os.remove(inner_sha)
300348
if os.path.exists(downloads_folder + '/' + inner_folder):
301-
# only works if the directory is empty
349+
# Only works if the directory is empty
302350
os.rmdir(downloads_folder + '/' + inner_folder)
303351
print("")
304352
elif len(contents) == 0:
@@ -311,7 +359,7 @@ def main():
311359
contents = tar.getnames()
312360
if len(contents) == 1:
313361
for f_name in contents:
314-
# remove existing version if exists
362+
# Remove existing version if exists
315363
new_file = downloads_folder + '/' + str(f_name)
316364
if "Driver" in new_file or "driver" in new_file:
317365
if os.path.exists(new_file):

seleniumbase/core/browser_launcher.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -510,20 +510,14 @@ def get_local_driver(
510510
elif browser_name == constants.Browser.EDGE:
511511
if LOCAL_EDGEDRIVER and os.path.exists(LOCAL_EDGEDRIVER):
512512
make_driver_executable_if_not(LOCAL_EDGEDRIVER)
513-
try:
514-
# The new Microsoft Edge browser is based on Chrome
515-
chrome_options = _set_chrome_options(
516-
downloads_path, headless,
517-
proxy_string, proxy_auth, proxy_user, proxy_pass,
518-
user_agent, disable_csp, enable_sync, user_data_dir,
519-
extension_zip, extension_dir)
520-
return webdriver.Chrome(executable_path=LOCAL_EDGEDRIVER,
521-
options=chrome_options)
522-
except Exception:
523-
try:
524-
return webdriver.Chrome(executable_path=LOCAL_EDGEDRIVER)
525-
except Exception:
526-
return webdriver.Edge(executable_path=LOCAL_EDGEDRIVER)
513+
# The new Microsoft Edge browser is based on Chromium
514+
chrome_options = _set_chrome_options(
515+
downloads_path, headless,
516+
proxy_string, proxy_auth, proxy_user, proxy_pass,
517+
user_agent, disable_csp, enable_sync, user_data_dir,
518+
extension_zip, extension_dir)
519+
return webdriver.Chrome(executable_path=LOCAL_EDGEDRIVER,
520+
options=chrome_options)
527521
else:
528522
return webdriver.Edge()
529523
elif browser_name == constants.Browser.SAFARI:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
setup(
4747
name='seleniumbase',
48-
version='1.31.6',
48+
version='1.31.7',
4949
description='Fast, Easy, and Reliable Browser Automation & Testing.',
5050
long_description=long_description,
5151
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)