MCPcopy Index your code
hub / github.com/seleniumbase/SeleniumBase / load_html_file

Method load_html_file

seleniumbase/fixtures/base_case.py:3425–3445  ·  view source on GitHub ↗

Loads a local html file into the browser from a relative file path. If new_page==True, the page will switch to: "data:text/html," If new_page==False, will load HTML into the current page. Local images and other local src content WILL BE IGNORED.

(self, html_file, new_page=True)

Source from the content-addressed store, hash-verified

3423 self.load_html_string(html_string, new_page=new_page)
3424
3425 def load_html_file(self, html_file, new_page=True):
3426 """Loads a local html file into the browser from a relative file path.
3427 If new_page==True, the page will switch to: "data:text/html,"
3428 If new_page==False, will load HTML into the current page.
3429 Local images and other local src content WILL BE IGNORED."""
3430 self.__check_scope()
3431 if self.__looks_like_a_page_url(html_file):
3432 self.open(html_file)
3433 return
3434 if len(html_file) < 6 or not html_file.endswith(".html"):
3435 raise Exception('Expecting a ".html" file!')
3436 abs_path = os.path.abspath(".")
3437 file_path = None
3438 if abs_path in html_file:
3439 file_path = html_file
3440 else:
3441 file_path = os.path.join(abs_path, html_file)
3442 html_string = None
3443 with open(file_path, "r") as f:
3444 html_string = f.read().strip()
3445 self.load_html_string(html_string, new_page)
3446
3447 def open_html_file(self, html_file):
3448 """Opens a local html file into the browser from a relative file path.

Callers 11

html_bestand_ladenMethod · 0.80
charger_html_fichierMethod · 0.80
caricare_html_fileMethod · 0.80
cargar_archivo_htmlMethod · 0.80
HTML_파일_로드Method · 0.80
加载HTML文件Method · 0.80
carregar_arquivo_htmlMethod · 0.80
test_demo_pageMethod · 0.80
test_extended_driverMethod · 0.80

Calls 4

__check_scopeMethod · 0.95
openMethod · 0.95
load_html_stringMethod · 0.95

Tested by 2

test_demo_pageMethod · 0.64
test_extended_driverMethod · 0.64