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

Method begin_presentation

seleniumbase/fixtures/base_case.py:12609–12664  ·  view source on GitHub ↗

Begin a Reveal-JS Presentation in the web browser. @Params name - If creating multiple presentations at the same time, use this to select the one you wish to use. filename - The name of the HTML file that you wish to save the presentation to.

(
        self, name=None, filename=None, show_notes=False, interval=0
    )

Source from the content-addressed store, hash-verified

12607 return file_path
12608
12609 def begin_presentation(
12610 self, name=None, filename=None, show_notes=False, interval=0
12611 ):
12612 """Begin a Reveal-JS Presentation in the web browser.
12613 @Params
12614 name - If creating multiple presentations at the same time,
12615 use this to select the one you wish to use.
12616 filename - The name of the HTML file that you wish to
12617 save the presentation to. (filename must end in ".html")
12618 show_notes - When set to True, the Notes feature becomes enabled,
12619 which allows presenters to see notes next to slides.
12620 interval - The delay time between autoplaying slides. (in seconds)
12621 If set to 0 (default), autoplay is disabled."""
12622 if self.headless or self.headless2 or self.xvfb:
12623 return # Presentations should not run in headless mode.
12624 if not name:
12625 name = "default"
12626 if not filename:
12627 filename = "my_presentation.html"
12628 if name not in self._presentation_slides:
12629 raise Exception("Presentation {%s} does not exist!" % name)
12630 if not filename.endswith(".html"):
12631 raise Exception('Presentation file must end in ".html"!')
12632 if not interval:
12633 interval = 0
12634 if interval == 0 and self.interval:
12635 interval = float(self.interval)
12636 if not isinstance(interval, (int, float)):
12637 raise Exception('Expecting a numeric value for "interval"!')
12638 if interval < 0:
12639 raise Exception('The "interval" cannot be a negative number!')
12640 end_slide = (
12641 '\n<section data-transition="none">\n'
12642 '<p class="End_Presentation_Now"> </p>\n</section>\n'
12643 )
12644 self._presentation_slides[name].append(end_slide)
12645 file_path = self.save_presentation(
12646 name=name,
12647 filename=filename,
12648 show_notes=show_notes,
12649 interval=interval,
12650 )
12651 self._presentation_slides[name].pop()
12652 self.open_html_file(file_path)
12653 presentation_folder = constants.Presentations.SAVED_FOLDER
12654 with suppress(Exception):
12655 while (
12656 len(self.driver.window_handles) > 0
12657 and presentation_folder in self.get_current_url()
12658 ):
12659 time.sleep(0.05)
12660 if self.is_element_visible(
12661 "section.present p.End_Presentation_Now"
12662 ):
12663 break
12664 time.sleep(0.05)
12665
12666 ############

Calls 5

save_presentationMethod · 0.95
open_html_fileMethod · 0.95
get_current_urlMethod · 0.95
is_element_visibleMethod · 0.95
sleepMethod · 0.45

Tested by 15

test_presentationMethod · 0.64
test_presentation_5Method · 0.64
test_presentation_4Method · 0.64
test_presentationMethod · 0.64
test_presentationMethod · 0.64
test_py_virtual_envsMethod · 0.64
test_hacking_with_cdpMethod · 0.64
test_presenterMethod · 0.64
test_presentation_3Method · 0.64
test_hacking_with_cdpMethod · 0.64
test_multi_seriesMethod · 0.64