Improve arg-parsing for Selenium Grid usage

This commit is contained in:
Michael Mintz 2021-11-15 13:52:49 -05:00
parent 3ddc9979bc
commit fdca9e43f4
1 changed files with 23 additions and 1 deletions

View File

@ -877,7 +877,29 @@ def get_remote_driver(
device_pixel_ratio,
):
downloads_path = download_helper.get_downloads_folder()
address = "%s://%s:%s/wd/hub" % (protocol, servername, port)
if servername.startswith("https://"):
protocol = "https"
servername = servername.split("https://")[1]
elif "://" in servername:
servername = servername.split("://")[1]
server_with_port = ""
if ":" not in servername:
col_port = ":" + str(port)
first_slash = servername.find("/")
if first_slash != -1:
server_with_port = (
servername[:first_slash] + col_port + servername[first_slash:]
)
else:
server_with_port = servername + col_port
else:
server_with_port = servername
address = "%s://%s" % (protocol, server_with_port)
if not address.endswith("/wd/hub"):
if address.endswith("/"):
address += "wd/hub"
else:
address += "/wd/hub"
desired_caps = {}
extra_caps = {}
if cap_file: