🚎 Tour Maker
Interactive Product Tours 🚎¶
Increase SaaS Product Adoption by 10x or more.
A tour demo: (with autoplay)
cd examples/tour_examples pytest maps_introjs_tour.py --interval=1
Here's a longer version:
cd examples/tour_examples pytest google_tour.py
Creating a new tour¶
To create a tour utilizing the Shepherd Library, use one of the following¶
You can pass a custom theme to change the look & feel of Shepherd tours. Valid themes for Shepherd Tours are
To create a tour utilizing the Bootstrap Tour Library, use one of the following¶
To create a tour utilizing the IntroJS Library, use one of the following¶
To create a tour utilizing the DriverJS Library, use one of the following¶
To create a tour utilizing the Hopscotch Library, use one of the following¶
Adding a step to a tour¶
To add a tour step, use the following¶
self.add_tour_step(message, css_selector, title, alignment, theme)
self.add_tour_step()method, you must first pass a message to display. You can then specify a web element to attach to (by using CSS selectors). If no element is specified, the tour step will tether to the top of the screen by default. You can also add an optional title above the message to display with the tour step, as well as change the theme for that step (Shepherd tours only), and even specify the alignment (which is the side of the element that you want the tour message to tether to).
Playing a tour¶
You can play a tour by calling:
If you specify an
interval(optional), the tour will automatically walk through each step after that many seconds have passed.
All methods have the optional
name argument, which is only needed if you're creating multiple tours at once. Then, when you're adding a step or playing a tour, SeleniumBase knows which tour you're referring too. You can avoid using the
name arg for multiple tours if you play a tour before creating a new one.
Here's how the code looks¶
from seleniumbase import BaseCase BaseCase.main(__name__, __file__) class MyTourClass(BaseCase): def test_google_tour(self): self.open('https://google.com/ncr') self.wait_for_element('input[title="Search"]') self.hide_elements("iframe") self.create_tour(theme="dark") self.add_tour_step("Welcome to Google!", title="SeleniumBase Tours") self.add_tour_step("Type in your query here.", '[title="Search"]') self.play_tour() self.highlight_type('input[title="Search"]', "Google") self.wait_for_element('[role="listbox"]') # Wait for autocomplete self.create_tour(theme="light") self.add_tour_step("Then click to search.", '[value="Google Search"]') self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]') self.play_tour()
That code is from google_tour.py, which you can run from the
tour_examples/ folder with the following command¶
Exporting a Tour¶
nameis optional unless you gave custom names to your tours when you created them.