Add compatibility with Selenoid Selenium grids
This commit is contained in:
parent
85f7777e49
commit
701973473b
|
@ -0,0 +1,8 @@
|
||||||
|
# Desired capabilities example file for Selenoid Grid
|
||||||
|
#
|
||||||
|
# The same result can be achieved on the command-line with:
|
||||||
|
# --cap-string='{"selenoid": "true"}'
|
||||||
|
|
||||||
|
capabilities = {
|
||||||
|
"selenoid": "true",
|
||||||
|
}
|
|
@ -970,10 +970,17 @@ def get_remote_driver(
|
||||||
else:
|
else:
|
||||||
capabilities = chrome_options.to_capabilities()
|
capabilities = chrome_options.to_capabilities()
|
||||||
# Set custom desired capabilities
|
# Set custom desired capabilities
|
||||||
|
selenoid = False
|
||||||
for key in desired_caps.keys():
|
for key in desired_caps.keys():
|
||||||
capabilities[key] = desired_caps[key]
|
capabilities[key] = desired_caps[key]
|
||||||
|
if key == "selenoid" and desired_caps[key]:
|
||||||
|
selenoid = True
|
||||||
if selenium4:
|
if selenium4:
|
||||||
chrome_options.set_capability("cloud:options", capabilities)
|
chrome_options.set_capability("cloud:options", capabilities)
|
||||||
|
if selenoid:
|
||||||
|
chrome_options.set_capability(
|
||||||
|
"selenoid:options", {"enableVNC": True}
|
||||||
|
)
|
||||||
return webdriver.Remote(
|
return webdriver.Remote(
|
||||||
command_executor=address,
|
command_executor=address,
|
||||||
options=chrome_options,
|
options=chrome_options,
|
||||||
|
@ -1007,10 +1014,17 @@ def get_remote_driver(
|
||||||
if headless:
|
if headless:
|
||||||
capabilities["moz:firefoxOptions"] = {"args": ["-headless"]}
|
capabilities["moz:firefoxOptions"] = {"args": ["-headless"]}
|
||||||
# Set custom desired capabilities
|
# Set custom desired capabilities
|
||||||
|
selenoid = False
|
||||||
for key in desired_caps.keys():
|
for key in desired_caps.keys():
|
||||||
capabilities[key] = desired_caps[key]
|
capabilities[key] = desired_caps[key]
|
||||||
|
if key == "selenoid" and desired_caps[key]:
|
||||||
|
selenoid = True
|
||||||
if selenium4:
|
if selenium4:
|
||||||
firefox_options.set_capability("cloud:options", capabilities)
|
firefox_options.set_capability("cloud:options", capabilities)
|
||||||
|
if selenoid:
|
||||||
|
firefox_options.set_capability(
|
||||||
|
"selenoid:options", {"enableVNC": True}
|
||||||
|
)
|
||||||
return webdriver.Remote(
|
return webdriver.Remote(
|
||||||
command_executor=address,
|
command_executor=address,
|
||||||
options=firefox_options,
|
options=firefox_options,
|
||||||
|
@ -1175,9 +1189,17 @@ def get_remote_driver(
|
||||||
keep_alive=True,
|
keep_alive=True,
|
||||||
)
|
)
|
||||||
elif browser_name == constants.Browser.REMOTE:
|
elif browser_name == constants.Browser.REMOTE:
|
||||||
|
selenoid = False
|
||||||
|
for key in desired_caps.keys():
|
||||||
|
if key == "selenoid" and desired_caps[key]:
|
||||||
|
selenoid = True
|
||||||
if selenium4:
|
if selenium4:
|
||||||
remote_options = ArgOptions()
|
remote_options = ArgOptions()
|
||||||
remote_options.set_capability("cloud:options", desired_caps)
|
remote_options.set_capability("cloud:options", desired_caps)
|
||||||
|
if selenoid:
|
||||||
|
remote_options.set_capability(
|
||||||
|
"selenoid:options", {"enableVNC": True}
|
||||||
|
)
|
||||||
return webdriver.Remote(
|
return webdriver.Remote(
|
||||||
command_executor=address,
|
command_executor=address,
|
||||||
options=remote_options,
|
options=remote_options,
|
||||||
|
|
Loading…
Reference in New Issue