Skip to content

Commit 3ae728f

Browse files
committed
Handle edge cases with EdgeDriver
1 parent e25573d commit 3ae728f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,6 +1837,14 @@ def get_local_driver(
18371837
edge_version = e.msg.split(
18381838
"only supports MSEdge version "
18391839
)[1].split(" ")[0]
1840+
elif "DevToolsActivePort file doesn't exist" in e.msg:
1841+
service = EdgeService(
1842+
executable_path=LOCAL_EDGEDRIVER,
1843+
log_path=os.path.devnull,
1844+
)
1845+
# https://stackoverflow.com/a/56638103/7058266
1846+
edge_options.add_argument("--remote-debugging-port=9222")
1847+
return Edge(service=service, options=edge_options)
18401848
if not auto_upgrade_edgedriver:
18411849
raise Exception(e.msg) # Not an obvious fix. Raise.
18421850
else:
@@ -1884,6 +1892,14 @@ def get_local_driver(
18841892
edge_version = e.msg.split(
18851893
"only supports MSEdge version "
18861894
)[1].split(" ")[0]
1895+
elif "DevToolsActivePort file doesn't exist" in e.msg:
1896+
service = EdgeService(
1897+
executable_path=LOCAL_EDGEDRIVER,
1898+
log_path=os.path.devnull,
1899+
)
1900+
# https://stackoverflow.com/a/56638103/7058266
1901+
edge_options.add_argument("--remote-debugging-port=9222")
1902+
return Edge(service=service, options=edge_options)
18871903
if not auto_upgrade_edgedriver:
18881904
raise Exception(e.msg) # Not an obvious fix. Raise.
18891905
else:

0 commit comments

Comments
 (0)