Update SeleniumBase Tour examples

This commit is contained in:
Michael Mintz 2019-09-02 16:11:05 -04:00
parent 1c88e8f37d
commit 24c6bf4b4e
8 changed files with 151 additions and 191 deletions

View File

@ -80,20 +80,16 @@ class MyTourClass(BaseCase):
self.wait_for_element('input[title="Search"]')
self.create_tour(theme="dark")
self.add_tour_step(
"Click to begin the Google Tour!", title="SeleniumBase Tours")
self.add_tour_step(
"Type in your search query here.", 'input[title="Search"]')
self.add_tour_step("Welcome to Google!", title="SeleniumBase Tours")
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "Google")
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
self.create_tour(theme="light")
self.add_tour_step(
"Then click here to search.", 'input[value="Google Search"]')
self.add_tour_step(
"Or press [ENTER] after typing a query here.", '[title="Search"]')
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()
```

View File

@ -8,20 +8,16 @@ class MyTourClass(BaseCase):
self.wait_for_element('input[title="Search"]')
self.create_bootstrap_tour() # OR self.create_tour(theme="bootstrap")
self.add_tour_step(
"Click to begin the Google Tour!", title="SeleniumBase Tours")
self.add_tour_step(
"Type in your search query here.", 'input[title="Search"]')
self.add_tour_step("Welcome to Google!", title="SeleniumBase Tours")
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "Google")
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
self.create_bootstrap_tour()
self.add_tour_step(
"Then click here to search.", 'input[value="Google Search"]')
self.add_tour_step(
"Or press [ENTER] after typing a query here.", '[title="Search"]')
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()
self.highlight_update_text('input[title="Search"]', "GitHub\n")
@ -29,8 +25,8 @@ class MyTourClass(BaseCase):
self.create_bootstrap_tour()
self.add_tour_step(
"Search results appear here!", title="(5-second autoplay on)")
self.add_tour_step("Let's take another tour:")
"See results here!", title="(autoplay in 5s)")
self.add_tour_step("Here's the next tour:")
self.play_tour(interval=5) # Tour automatically continues after 5 sec
self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
@ -40,29 +36,23 @@ class MyTourClass(BaseCase):
self.create_bootstrap_tour()
self.add_tour_step("Welcome to Google Maps!")
self.add_tour_step(
"Type in a location here.", "#searchboxinput", title="Search Box")
self.add_tour_step(
"Then click here to show it on the map.",
"#searchbox-searchbutton", alignment="bottom")
self.add_tour_step(
"Or click here to get driving directions.",
"#searchbox-directions", alignment="bottom")
self.add_tour_step(
"Use this button to switch to Satellite view.",
"#minimap div.widget-minimap", alignment="right")
self.add_tour_step(
"Click here to zoom in.", "#widget-zoom-in", alignment="left")
self.add_tour_step(
"Or click here to zoom out.", "#widget-zoom-out", alignment="left")
self.add_tour_step(
"Use the Menu button to see more options.",
".searchbox-hamburger-container", alignment="right")
self.add_tour_step(
"Or click here to see more Google apps.", '[title="Google apps"]',
alignment="left")
self.add_tour_step(
"Thanks for trying out SeleniumBase Tours!",
title="End of Guided Tour")
self.add_tour_step("Type in a location here.",
"#searchboxinput", title="Search Box")
self.add_tour_step("Then click here to show it on the map.",
"#searchbox-searchbutton", alignment="bottom")
self.add_tour_step("Or click here to get driving directions.",
"#searchbox-directions", alignment="bottom")
self.add_tour_step("Use this button to switch to Satellite view.",
"#minimap div.widget-minimap", alignment="right")
self.add_tour_step("Click here to zoom in.",
"#widget-zoom-in", alignment="left")
self.add_tour_step("Or click here to zoom out.",
"#widget-zoom-out", alignment="left")
self.add_tour_step("Use the Menu button to see more options.",
".searchbox-hamburger-container", alignment="right")
self.add_tour_step("Or click here to see more Google apps.",
'[title="Google apps"]', alignment="left")
self.add_tour_step("Thanks for using SeleniumBase Tours!",
title="End of Guided Tour")
self.export_tour(filename="bootstrap_google_maps_tour.js")
self.play_tour()

View File

@ -0,0 +1,21 @@
from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_basic(self):
self.open('https://xkcd.com/1117/')
self.assert_element('img[alt="My Sky"]')
self.create_bootstrap_tour()
self.add_tour_step("Welcome to XKCD!")
self.add_tour_step("This is the XKCD logo.", "#masthead img")
self.add_tour_step("Here's the daily webcomic.", "#comic img")
self.add_tour_step("This is the title.", "#ctitle", alignment="top")
self.add_tour_step("Click here for the next comic.", 'a[rel="next"]')
self.add_tour_step("Click here for the previous one.", 'a[rel="prev"]')
self.add_tour_step("Learn about the author here.", 'a[rel="author"]')
self.add_tour_step("Click here for the license.", 'a[rel="license"]')
self.add_tour_step("Click for a random comic.", 'a[href*="/random/"]')
self.add_tour_step("Thanks for taking this tour!")
self.export_tour(filename="bootstrap_xkcd_tour.js") # Exports the tour
self.play_tour() # Plays the tour

View File

@ -10,10 +10,8 @@ class MyTourClass(BaseCase):
# Create a website tour using the ShepherdJS library with "dark" theme
# Same as: self.create_shepherd_tour(theme="dark")
self.create_tour(theme="dark")
self.add_tour_step(
"Click to begin the Google Tour!", title="SeleniumBase Tours")
self.add_tour_step(
"Type in your search query here.", 'input[title="Search"]')
self.add_tour_step("Welcome to Google!", title="SeleniumBase Tours")
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "Google")
@ -22,10 +20,8 @@ class MyTourClass(BaseCase):
# Create a website tour using the ShepherdJS library with "light" theme
# Same as: self.create_shepherd_tour(theme="light")
self.create_tour(theme="light")
self.add_tour_step(
"Then click here to search.", 'input[value="Google Search"]')
self.add_tour_step(
"Or press [ENTER] after typing a query here.", '[title="Search"]')
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()
self.highlight_update_text('input[title="Search"]', "GitHub\n")
@ -34,9 +30,8 @@ class MyTourClass(BaseCase):
# Create a website tour using the Bootstrap Tour JS library
# Same as: self.create_bootstrap_tour()
self.create_tour(theme="bootstrap")
self.add_tour_step(
"Search results appear here!", title="(5-second autoplay on)")
self.add_tour_step("Let's take another tour:", theme="light")
self.add_tour_step("See results here!", title="(autoplay in 5s)")
self.add_tour_step("Here's the next tour:")
self.play_tour(interval=5) # Tour automatically continues after 5 sec
self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
@ -47,31 +42,24 @@ class MyTourClass(BaseCase):
# Create a website tour using the IntroJS library
# Same as: self.create_introjs_tour()
self.create_tour(theme="introjs")
self.add_tour_step(
"Welcome to Google Maps!")
self.add_tour_step(
"Type in a location here.", "#searchboxinput", title="Search Box")
self.add_tour_step(
"Then click here to show it on the map.",
"#searchbox-searchbutton", alignment="bottom")
self.add_tour_step(
"Or click here to get driving directions.",
"#searchbox-directions", alignment="bottom")
self.add_tour_step(
"Use this button to switch to Satellite view.",
"#minimap div.widget-minimap", alignment="right")
self.add_tour_step(
"Click here to zoom in.", "#widget-zoom-in", alignment="left")
self.add_tour_step(
"Or click here to zoom out.", "#widget-zoom-out", alignment="left")
self.add_tour_step(
"Use the Menu button to see more options.",
".searchbox-hamburger-container", alignment="right")
self.add_tour_step(
"Or click here to see more Google apps.", '[title="Google apps"]',
alignment="left")
self.add_tour_step(
"Thanks for trying out SeleniumBase Tours!",
title="End of Guided Tour")
self.export_tour()
self.add_tour_step("Welcome to Google Maps!")
self.add_tour_step("Type in a location here.",
"#searchboxinput", title="Search Box")
self.add_tour_step("Then click here to show it on the map.",
"#searchbox-searchbutton", alignment="bottom")
self.add_tour_step("Or click here to get driving directions.",
"#searchbox-directions", alignment="bottom")
self.add_tour_step("Use this button to switch to Satellite view.",
"#minimap div.widget-minimap", alignment="right")
self.add_tour_step("Click here to zoom in.",
"#widget-zoom-in", alignment="left")
self.add_tour_step("Or click here to zoom out.",
"#widget-zoom-out", alignment="left")
self.add_tour_step("Use the Menu button to see more options.",
".searchbox-hamburger-container", alignment="right")
self.add_tour_step("Or click here to see more Google apps.",
'[title="Google apps"]', alignment="left")
self.add_tour_step("Thanks for using SeleniumBase Tours!",
title="End of Guided Tour")
self.export_tour() # The default name for exports is "my_tour.js"
self.play_tour()

View File

@ -8,21 +8,16 @@ class MyTourClass(BaseCase):
self.wait_for_element('input[title="Search"]')
self.create_hopscotch_tour() # OR self.create_tour(theme="hopscotch")
self.add_tour_step(
"Click to begin the Google Tour!", title="SeleniumBase Tours")
self.add_tour_step(
"Type in your search query here.", 'input[title="Search"]')
self.add_tour_step("Welcome to Google!", title="SeleniumBase Tours")
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "Google")
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
self.create_hopscotch_tour()
self.add_tour_step(
"Then click here to search.", 'input[value="Google Search"]',
alignment="top")
self.add_tour_step(
"Or press [ENTER] after typing a query here.", '[title="Search"]')
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()
self.highlight_update_text('input[title="Search"]', "GitHub\n")
@ -30,8 +25,8 @@ class MyTourClass(BaseCase):
self.create_hopscotch_tour()
self.add_tour_step(
"Search results appear here!", title="(5-second autoplay on)")
self.add_tour_step("Let's take another tour:")
"See results here!", title="(autoplay in 5s)")
self.add_tour_step("Here's the next tour:")
self.play_tour(interval=5) # Tour automatically continues after 5 sec
self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
@ -41,29 +36,23 @@ class MyTourClass(BaseCase):
self.create_hopscotch_tour()
self.add_tour_step("Welcome to Google Maps!")
self.add_tour_step(
"Type in a location here.", "#searchboxinput", title="Search Box")
self.add_tour_step(
"Then click here to show it on the map.",
"#searchbox-searchbutton", alignment="bottom")
self.add_tour_step(
"Or click here to get driving directions.",
"#searchbox-directions", alignment="bottom")
self.add_tour_step(
"Use this button to switch to Satellite view.",
"#minimap div.widget-minimap", alignment="right")
self.add_tour_step(
"Click here to zoom in.", "#widget-zoom-in", alignment="left")
self.add_tour_step(
"Or click here to zoom out.", "#widget-zoom-out", alignment="left")
self.add_tour_step(
"Use the Menu button to see more options.",
".searchbox-hamburger-container", alignment="right")
self.add_tour_step(
"Or click here to see more Google apps.", '[title="Google apps"]',
alignment="left")
self.add_tour_step(
"Thanks for trying out SeleniumBase Tours!",
title="End of Guided Tour")
self.add_tour_step("Type in a location here.",
"#searchboxinput", title="Search Box")
self.add_tour_step("Then click here to show it on the map.",
"#searchbox-searchbutton", alignment="bottom")
self.add_tour_step("Or click here to get driving directions.",
"#searchbox-directions", alignment="bottom")
self.add_tour_step("Use this button to switch to Satellite view.",
"#minimap div.widget-minimap", alignment="right")
self.add_tour_step("Click here to zoom in.",
"#widget-zoom-in", alignment="left")
self.add_tour_step("Or click here to zoom out.",
"#widget-zoom-out", alignment="left")
self.add_tour_step("Use the Menu button to see more options.",
".searchbox-hamburger-container", alignment="right")
self.add_tour_step("Or click here to see more Google apps.",
'[title="Google apps"]', alignment="left")
self.add_tour_step("Thanks for using SeleniumBase Tours!",
title="End of Guided Tour")
self.export_tour(filename="hopscotch_google_maps_tour.js")
self.play_tour()

View File

@ -8,29 +8,24 @@ class MyTourClass(BaseCase):
self.wait_for_element('input[title="Search"]')
self.create_introjs_tour() # OR self.create_tour(theme="introjs")
self.add_tour_step(
"Click to begin the Google Tour!", title="SeleniumBase Tours")
self.add_tour_step(
"Type in your search query here.", 'input[title="Search"]')
self.add_tour_step("Welcome to Google!", title="SeleniumBase Tours")
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "Google")
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
self.create_introjs_tour()
self.add_tour_step(
"Then click here to search.", 'input[value="Google Search"]')
self.add_tour_step(
"Or press [ENTER] after typing a query here.", '[title="Search"]')
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()
self.highlight_update_text('input[title="Search"]', "GitHub\n")
self.wait_for_element("#search")
self.create_introjs_tour()
self.add_tour_step(
"Search results appear here!", title="(5-second autoplay on)")
self.add_tour_step("Let's take another tour:")
self.add_tour_step("See results here!", title="(autoplay in 5s)")
self.add_tour_step("Here's the next tour:")
self.play_tour(interval=5) # Tour automatically continues after 5 sec
self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
@ -40,29 +35,23 @@ class MyTourClass(BaseCase):
self.create_introjs_tour()
self.add_tour_step("Welcome to Google Maps!")
self.add_tour_step(
"Type in a location here.", "#searchboxinput", title="Search Box")
self.add_tour_step(
"Then click here to show it on the map.",
"#searchbox-searchbutton", alignment="bottom")
self.add_tour_step(
"Or click here to get driving directions.",
"#searchbox-directions", alignment="bottom")
self.add_tour_step(
"Use this button to switch to Satellite view.",
"#minimap div.widget-minimap", alignment="right")
self.add_tour_step(
"Click here to zoom in.", "#widget-zoom-in", alignment="left")
self.add_tour_step(
"Or click here to zoom out.", "#widget-zoom-out", alignment="left")
self.add_tour_step(
"Use the Menu button to see more options.",
".searchbox-hamburger-container", alignment="right")
self.add_tour_step(
"Or click here to see more Google apps.", '[title="Google apps"]',
alignment="left")
self.add_tour_step(
"Thanks for trying out SeleniumBase Tours!",
title="End of Guided Tour")
self.add_tour_step("Type in a location here.",
"#searchboxinput", title="Search Box")
self.add_tour_step("Then click here to show it on the map.",
"#searchbox-searchbutton", alignment="bottom")
self.add_tour_step("Or click here to get driving directions.",
"#searchbox-directions", alignment="bottom")
self.add_tour_step("Use this button to switch to Satellite view.",
"#minimap div.widget-minimap", alignment="right")
self.add_tour_step("Click here to zoom in.",
"#widget-zoom-in", alignment="left")
self.add_tour_step("Or click here to zoom out.",
"#widget-zoom-out", alignment="left")
self.add_tour_step("Use the Menu button to see more options.",
".searchbox-hamburger-container", alignment="right")
self.add_tour_step("Or click here to see more Google apps.",
'[title="Google apps"]', alignment="left")
self.add_tour_step("Thanks for using SeleniumBase Tours!",
title="End of Guided Tour")
self.export_tour(filename="introjs_google_maps_tour.js")
self.play_tour()

View File

@ -8,20 +8,16 @@ class MyTourClass(BaseCase):
self.wait_for_element('input[title="Search"]')
self.create_shepherd_tour(theme="dark")
self.add_tour_step(
"Click to begin the Google Tour!", title="SeleniumBase Tours")
self.add_tour_step(
"Type in your search query here.", 'input[title="Search"]')
self.add_tour_step("Welcome to Google!", title="SeleniumBase Tours")
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "Google")
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
self.create_shepherd_tour(theme="light")
self.add_tour_step(
"Then click here to search.", 'input[value="Google Search"]')
self.add_tour_step(
"Or press [ENTER] after typing a query here.", '[title="Search"]')
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()
self.highlight_update_text('input[title="Search"]', "GitHub\n")
@ -29,10 +25,8 @@ class MyTourClass(BaseCase):
self.create_shepherd_tour(theme="square-dark")
self.add_tour_step(
"Search results appear here!", title="(5-second autoplay on)")
self.add_tour_step(
"The next tour begins in a few seconds...", theme="square",
title="(5-second autoplay on)")
"See results here!", title="(autoplay in 5s)", theme="square")
self.add_tour_step("Here's the next tour:")
self.play_tour(interval=5) # Tour automatically continues after 5 sec
self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
@ -41,32 +35,25 @@ class MyTourClass(BaseCase):
self.wait_for_element("#zoom")
self.create_shepherd_tour(theme="dark")
self.add_tour_step(
"Welcome to Google Maps!")
self.add_tour_step(
"Type in a location here.", "#searchboxinput", title="Search Box")
self.add_tour_step(
"Then click here to show it on the map.",
"#searchbox-searchbutton", alignment="bottom")
self.add_tour_step(
"Or click here to get driving directions.",
"#searchbox-directions", alignment="bottom", theme="dark")
self.add_tour_step(
"Use this button to switch to Satellite view.",
"#minimap div.widget-minimap", alignment="right")
self.add_tour_step(
"Click here to zoom in.", "#widget-zoom-in", alignment="left")
self.add_tour_step(
"Or click here to zoom out.", "#widget-zoom-out",
alignment="left", theme="light")
self.add_tour_step(
"Use the Menu button to see more options.",
".searchbox-hamburger-container", alignment="right")
self.add_tour_step(
"Or click here to see more Google apps.", '[title="Google apps"]',
alignment="left")
self.add_tour_step(
"Thanks for trying out SeleniumBase Tours!",
title="End of Guided Tour", theme="light")
self.add_tour_step("Welcome to Google Maps!")
self.add_tour_step("Type in a location here.",
"#searchboxinput", title="Search Box")
self.add_tour_step("Then click here to show it on the map.",
"#searchbox-searchbutton", alignment="bottom")
self.add_tour_step("Or click here to get driving directions.",
"#searchbox-directions",
alignment="bottom", theme="dark")
self.add_tour_step("Use this button to switch to Satellite view.",
"#minimap div.widget-minimap", alignment="right")
self.add_tour_step("Click here to zoom in.",
"#widget-zoom-in", alignment="left")
self.add_tour_step("Or click here to zoom out.",
"#widget-zoom-out", alignment="left", theme="light")
self.add_tour_step("Use the Menu button to see more options.",
".searchbox-hamburger-container", alignment="right")
self.add_tour_step("Or click here to see more Google apps.",
'[title="Google apps"]', alignment="left")
self.add_tour_step("Thanks for using SeleniumBase Tours!",
title="End of Guided Tour", theme="light")
self.export_tour(filename="shepherd_google_maps_tour.js")
self.play_tour()

View File

@ -17,5 +17,5 @@ class MyTestClass(BaseCase):
self.add_tour_step("Click here for the license.", 'a[rel="license"]')
self.add_tour_step("Click for a random comic.", 'a[href*="/random/"]')
self.add_tour_step("Thanks for taking this tour!")
self.export_tour(filename="xkcd_tour.js") # This exports the tour
self.play_tour() # This plays the tour
self.export_tour(filename="xkcd_tour.js") # Exports the tour
self.play_tour() # Plays the tour