Best Python code snippet using SeleniumBase
xkcd_tour.py
Source:xkcd_tour.py
1from seleniumbase import BaseCase2class MyTestClass(BaseCase):3 def test_create_tour(self):4 self.open("https://xkcd.com/1117/")5 self.assert_element('img[alt="My Sky"]')6 self.create_tour(theme="dark")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 here for the license.", 'a[rel="license"]')15 self.add_tour_step("Click for a random comic.", 'a[href*="/random/"]')16 self.add_tour_step("Thanks for taking this tour!")17 self.export_tour(filename="xkcd_tour.js") # Exports 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!!