Skip to content

Commit 5c15469

Browse files
committed
Add the command-line option for start_page
1 parent 87c8a6a commit 5c15469

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3175,6 +3175,7 @@ def setUp(self, masterqa_mode=False):
31753175
self.headless = sb_config.headless
31763176
self.headless_active = False
31773177
self.headed = sb_config.headed
3178+
self.start_page = sb_config.start_page
31783179
self.log_path = sb_config.log_path
31793180
self.with_testing_base = sb_config.with_testing_base
31803181
self.with_basic_test_info = sb_config.with_basic_test_info

seleniumbase/plugins/pytest_plugin.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,13 @@ def pytest_addoption(parser):
203203
(The default setting on Linux is headless.)
204204
(The default setting on Mac or Windows is headed.)
205205
""")
206+
parser.addoption('--start_page', '--start-page', '--url',
207+
action='store',
208+
dest='start_page',
209+
default=None,
210+
help="""Designates the starting URL for the web browser
211+
when each test begins.
212+
Default: None.""")
206213
parser.addoption('--is_pytest', '--is-pytest',
207214
action="store_true",
208215
dest='is_pytest',
@@ -300,6 +307,7 @@ def pytest_configure(config):
300307
sb_config.user_agent = config.getoption('user_agent')
301308
sb_config.headless = config.getoption('headless')
302309
sb_config.headed = config.getoption('headed')
310+
sb_config.start_page = config.getoption('start_page')
303311
sb_config.extension_zip = config.getoption('extension_zip')
304312
sb_config.extension_dir = config.getoption('extension_dir')
305313
sb_config.with_testing_base = config.getoption('with_testing_base')

seleniumbase/plugins/selenium_plugin.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ def options(self, parser, env):
137137
a GUI when running tests on Linux machines.
138138
(The default setting on Linux is headless.)
139139
(The default setting on Mac or Windows is headed.)""")
140+
parser.add_option(
141+
'--start_page', '--start-page', '--url',
142+
action='store',
143+
dest='start_page',
144+
default=None,
145+
help="""Designates the starting URL for the web browser
146+
when each test begins.
147+
Default: None.""")
140148
parser.add_option(
141149
'--demo_mode', '--demo-mode', '--demo',
142150
action="store_true",
@@ -241,6 +249,7 @@ def beforeTest(self, test):
241249
test.test.cap_file = self.options.cap_file
242250
test.test.headless = self.options.headless
243251
test.test.headed = self.options.headed
252+
test.test.start_page = self.options.start_page
244253
test.test.servername = self.options.servername
245254
test.test.port = self.options.port
246255
test.test.user_data_dir = self.options.user_data_dir

0 commit comments

Comments
 (0)