MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / open_start_page

Method open_start_page

seleniumbase/fixtures/base_case.py:1401–1425  ·  view source on GitHub ↗

Navigates the current browser window to the start_page. You can set the start_page on the command-line in three ways: '--start_page=URL', '--start-page=URL', or '--url=URL'. If the start_page is not set, then "about:blank" will be used.

(self)

Source from the content-addressed store, hash-verified

1399 self.__demo_mode_pause_if_active()
1400
1401 def open_start_page(self):
1402 """Navigates the current browser window to the start_page.
1403 You can set the start_page on the command-line in three ways:
1404 '--start_page=URL', '--start-page=URL', or '--url=URL'.
1405 If the start_page is not set, then "about:blank" will be used."""
1406 self.__check_scope()
1407 start_page = self.start_page
1408 if isinstance(start_page, str):
1409 start_page = start_page.strip() # Remove extra whitespace
1410 if start_page and len(start_page) >= 4:
1411 if page_utils.is_valid_url(start_page):
1412 self.open(start_page)
1413 else:
1414 new_start_page = "https://" + start_page
1415 if page_utils.is_valid_url(new_start_page):
1416 self.__dont_record_open = True
1417 self.open(new_start_page)
1418 self.__dont_record_open = False
1419 else:
1420 logging.info('Invalid URL: "%s"!' % start_page)
1421 if self.get_current_url() != "about:blank":
1422 self.open("about:blank")
1423 else:
1424 if self.get_current_url() != "about:blank":
1425 self.open("about:blank")
1426
1427 def open_if_not_url(self, url):
1428 """Opens the url in the browser if it's not the current url (*).

Callers 1

goto_start_pageMethod · 0.95

Calls 4

__check_scopeMethod · 0.95
openMethod · 0.95
get_current_urlMethod · 0.95
is_valid_urlMethod · 0.45

Tested by

no test coverage detected