Best Python code snippet using SeleniumBase
bootstrap_xkcd_tour.py
Source:bootstrap_xkcd_tour.py
1from seleniumbase import BaseCase2class MyTestClass(BaseCase):3 def test_bootstrap_tour(self):4 self.open("https://xkcd.com/1117/")5 self.assert_element('img[alt="My Sky"]')6 self.create_bootstrap_tour()7 self.add_tour_step("Welcome to XKCD!")8 self.add_tour_step("This is the XKCD logo.", "#masthead img")9 self.add_tour_step("Here's the daily webcomic.", "#comic img")10 self.add_tour_step("This is the title.", "#ctitle", alignment="top")11 self.add_tour_step("Click here for the next comic.", 'a[rel="next"]')12 self.add_tour_step("Click here for the previous one.", 'a[rel="prev"]')13 self.add_tour_step("Learn about the author here.", 'a[rel="author"]')14 self.add_tour_step("Click for a random comic.", 'a[href*="/random/"]')15 self.add_tour_step("Thanks for taking this tour!")16 self.export_tour(filename="bootstrap_xkcd_tour.js") # Exports the tour17 self.play_tour() # Plays the tour
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!!