Best Python code snippet using SeleniumBase
hopscotch_google_tour.py
Source:hopscotch_google_tour.py
2class MyTourClass(BaseCase):3 def test_google_tour(self):4 self.open("https://google.com/ncr")5 self.wait_for_element('input[title="Search"]')6 self.create_hopscotch_tour() # OR self.create_tour(theme="hopscotch")7 self.add_tour_step("Welcome to Google!", title="SeleniumBase Tours")8 self.add_tour_step("Type in your query here.", 'input[title="Search"]')9 self.play_tour()10 self.highlight_type('input[title="Search"]', "Google")11 self.wait_for_element('[role="listbox"]') # Wait for autocomplete12 self.create_hopscotch_tour()13 self.add_tour_step("Then click to search.", '[value="Google Search"]')14 self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')15 self.play_tour()16 self.highlight_type('input[title="Search"]', "GitHub\n")17 self.ad_block()18 self.wait_for_element("#search")19 self.create_hopscotch_tour()20 self.add_tour_step("3-second autoplay...")21 self.add_tour_step("Here's the next tour:")22 self.play_tour(interval=3) # Tour automatically continues after 3 sec23 self.open("https://www.google.com/maps/@42.3591234,-71.0915634,15z")24 self.wait_for_element("#searchboxinput", timeout=20)25 self.wait_for_element("#minimap", timeout=20)26 self.wait_for_element("#zoom", timeout=20)27 self.create_hopscotch_tour()28 self.add_tour_step("Welcome to Google Maps", title="SeleniumBase Tour")29 self.add_tour_step(30 "The location goes here.", "#searchboxinput", title="Search Box"31 )32 self.add_tour_step(33 "Then click here to show it on the map.",34 "#searchbox-searchbutton",35 alignment="bottom",36 )37 self.add_tour_step(38 "Or click here to get driving directions.",39 'button[aria-label="Directions"]',40 alignment="bottom",41 )...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!