Skip to content

Commit a5d90ce

Browse files
committed
Use the "https" protocol for the Grid Server if the port is "443"
1 parent 04235ab commit a5d90ce

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

seleniumbase/plugins/pytest_plugin.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ def pytest_addoption(parser):
374374
dest="port",
375375
default="4444",
376376
help="""Designates the Selenium Grid port to use.
377-
Default: 4444.""",
377+
Default: 4444. (If 443, protocol becomes "https")""",
378378
)
379379
parser.addoption(
380380
"--proxy",
@@ -987,6 +987,11 @@ def pytest_configure(config):
987987
sb_config.protocol = config.getoption("protocol")
988988
sb_config.servername = config.getoption("servername")
989989
sb_config.port = config.getoption("port")
990+
if sb_config.servername != "localhost":
991+
# Using Selenium Grid
992+
# (Set --server="127.0.0.1" for localhost Grid)
993+
if str(sb_config.port) == "443":
994+
sb_config.protocol = "https"
990995
sb_config.proxy_string = config.getoption("proxy_string")
991996
sb_config.cap_file = config.getoption("cap_file")
992997
sb_config.cap_string = config.getoption("cap_string")

seleniumbase/plugins/selenium_plugin.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def options(self, parser, env):
143143
dest="port",
144144
default="4444",
145145
help="""Designates the Selenium Grid port to use.
146-
Default: 4444.""",
146+
Default: 4444. (If 443, protocol becomes "https")""",
147147
)
148148
parser.add_option(
149149
"--proxy",
@@ -632,13 +632,14 @@ def beforeTest(self, test):
632632
test.test.save_screenshot_after_test = self.options.save_screenshot
633633
test.test.visual_baseline = self.options.visual_baseline
634634
test.test.timeout_multiplier = self.options.timeout_multiplier
635-
test.test.use_grid = False
636635
test.test.dashboard = False
637636
test.test._multithreaded = False
638637
test.test._reuse_session = False
639638
if test.test.servername != "localhost":
640-
# Use Selenium Grid (Use --server="127.0.0.1" for localhost Grid)
641-
test.test.use_grid = True
639+
# Using Selenium Grid
640+
# (Set --server="127.0.0.1" for localhost Grid)
641+
if str(self.options.port) == "443":
642+
test.test.protocol = "https"
642643
if self.options.xvfb and "linux" not in sys.platform:
643644
# The Xvfb virtual display server is for Linux OS Only!
644645
self.options.xvfb = False

0 commit comments

Comments
 (0)