|
| 1 | +from seleniumbase import BaseCase |
| 2 | + |
| 3 | + |
| 4 | +class MyTourClass(BaseCase): |
| 5 | + |
| 6 | + def test_google_tour(self): |
| 7 | + self.open('https://google.com') |
| 8 | + self.wait_for_element('input[title="Search"]') |
| 9 | + |
| 10 | + self.create_hopscotch_tour() # OR self.create_tour(theme="hopscotch") |
| 11 | + self.add_tour_step( |
| 12 | + "Click to begin the Google Tour!", title="SeleniumBase Tours") |
| 13 | + self.add_tour_step( |
| 14 | + "Type in your search query here.", 'input[title="Search"]') |
| 15 | + self.play_tour() |
| 16 | + |
| 17 | + self.highlight_update_text('input[title="Search"]', "Google") |
| 18 | + self.wait_for_element('[role="listbox"]') # Wait for autocomplete |
| 19 | + |
| 20 | + self.create_hopscotch_tour() |
| 21 | + self.add_tour_step( |
| 22 | + "Then click here to search.", 'input[value="Google Search"]') |
| 23 | + self.add_tour_step( |
| 24 | + "Or press [ENTER] after typing a query here.", '[title="Search"]') |
| 25 | + self.play_tour() |
| 26 | + |
| 27 | + self.highlight_update_text('input[title="Search"]', "GitHub\n") |
| 28 | + self.wait_for_element("#search") |
| 29 | + |
| 30 | + self.create_hopscotch_tour() |
| 31 | + self.add_tour_step( |
| 32 | + "Search results appear here!", title="(5-second autoplay on)") |
| 33 | + self.add_tour_step("Let's take another tour:") |
| 34 | + self.play_tour(interval=5) # Tour automatically continues after 5 sec |
| 35 | + |
| 36 | + self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z") |
| 37 | + self.wait_for_element('input#searchboxinput') |
| 38 | + |
| 39 | + self.create_hopscotch_tour() |
| 40 | + self.add_tour_step("Welcome to Google Maps!") |
| 41 | + self.add_tour_step( |
| 42 | + "Type in a location here.", "#searchboxinput", title="Search Box") |
| 43 | + self.add_tour_step( |
| 44 | + "Then click here to show it on the map.", |
| 45 | + "#searchbox-searchbutton", alignment="bottom") |
| 46 | + self.add_tour_step( |
| 47 | + "Or click here to get driving directions.", |
| 48 | + "#searchbox-directions", alignment="bottom") |
| 49 | + self.add_tour_step( |
| 50 | + "Use this button to switch to Satellite view.", |
| 51 | + "div.widget-minimap", alignment="right") |
| 52 | + self.add_tour_step( |
| 53 | + "Click here to zoom in.", "#widget-zoom-in", alignment="left") |
| 54 | + self.add_tour_step( |
| 55 | + "Or click here to zoom out.", "#widget-zoom-out", alignment="left") |
| 56 | + self.add_tour_step( |
| 57 | + "Use the Menu button to see more options.", |
| 58 | + ".searchbox-hamburger-container", alignment="right") |
| 59 | + self.add_tour_step( |
| 60 | + "Or click here to see more Google apps.", '[title="Google apps"]', |
| 61 | + alignment="left") |
| 62 | + self.add_tour_step( |
| 63 | + "Thanks for trying out SeleniumBase Tours!", |
| 64 | + title="End of Guided Tour") |
| 65 | + self.play_tour() |
0 commit comments