How to use add_tour_step method in SeleniumBase

Best Python code snippet using SeleniumBase

katgui_tour.py

Source:katgui_tour.py Github

copy

Full Screen

1import os2from seleniumbase import BaseCase3from .utils import TexttoSpeech4KATGUI_USER = os.getenv("KATGUI_USER")5KATGUI_PASS = os.getenv("KATGUI_PASS")6THEME = "dark"7KATGUI_URL = "http://monctl.devx.camlab.kat.ac.za/katgui/login"8class MyTourClass(BaseCase):9 speak = TexttoSpeech10 def enter_stage(self, func, *args: str, **kwargs: str) -> None:11 """Wrapper function for creating and playing the tour"""12 self.create_tour(theme=THEME)13 func(*args, **kwargs)14 self.play_tour()15 def login_katgui(self) -> None:16 """Detailed login in instructions for KATGUI end-user."""17 self.open(KATGUI_URL)18 self.wait_for_element("#input_1")19 self.speak(20 "Welcome to the Karoo Array Telescope Graphical User Interface, "21 "I will walk you through it!",22 "walkthrough",23 ).play_speech()24 self.enter_stage(25 self.add_tour_step, "Welcome to KATGUI!", title="MeerKAT KatGUI"26 )27 self.enter_stage(28 self.add_tour_step, "Type in your email account here.", "#input_1"29 )30 self.speak(31 "Please enter your S K A email address to login.", "enter_email"32 ).play_speech()33 self.assertIsNotNone(34 KATGUI_USER,35 "Ensure that KATGUI_USER as defined an environmental variables.",36 )37 self.highlight_update_text("#input_1", KATGUI_USER)38 self.assertIsNotNone(39 KATGUI_PASS,40 "Ensure that KATGUI_PASS as defined an environmental variables.",41 )42 self.enter_stage(self.add_tour_step, "Type in your password here.", "#input_2")43 self.speak("Please enter your password!", "enter_pass").play_speech()44 self.highlight_update_text("#input_2", KATGUI_PASS)45 self.speak(46 "In order to have full control of the interface, "47 "you will need to login as an Expert User!",48 "expert_user",49 ).play_speech()50 self.enter_stage(51 self.add_tour_step, "Login as 'Expert User'.", "#select_value_label_0"52 )53 self.click("#select_value_label_0")54 self.click("#select_option_6")55 self.speak(56 "Click login button or hit Enter on your keyboard to login!", "login",57 ).play_speech()58 selector = "#ui-view-container-div > div > form > button"59 self.enter_stage(self.add_tour_step, "Then click to 'Login'.", selector)60 self.enter_stage(self.add_tour_step, "Or press [ENTER] after entry.", selector)61 self.click(selector)62 def disable_alarms(self):63 self.enter_stage(64 self.add_tour_step,65 "You might need to disable the alarms and notification.",66 title="Disable Alarms",67 )68 user_icon = "#main-top-toolbar > div > button:nth-child(7) > span"69 self.enter_stage(70 self.add_tour_step, "Click on the user icon on the top-right.", user_icon71 )72 self.click(user_icon)73 alarm_not = (74 "body > md-content > md-sidenav.md-sidenav-right._md.md-deep-"75 "purple-theme.layout-column > md-content > md-list > md-item:nth-child(5) > "76 "md-item-content:nth-child(2) > md-checkbox > div.md-label"77 )78 self.enter_stage(79 self.add_tour_step,80 "Click on the checkbox to disable 'Alarm Notifications'.",81 alarm_not,82 )83 self.click(alarm_not)84 alarm_sound = (85 "body > md-content > md-sidenav.md-sidenav-right._md.md-deep-purple-theme."86 "layout-column > md-content > md-list > md-item:nth-child(5) > "87 "md-item-content:nth-child(4) > md-checkbox > div.md-container.md-ink-ripple"88 )89 self.enter_stage(90 self.add_tour_step,91 "Click on the checkbox to disable 'Alarm Sounds'.",92 alarm_sound,93 )94 self.click(alarm_sound)95 home = '//*[@id="main-top-toolbar"]/div/span'96 self.enter_stage(97 self.add_tour_step,98 "Click anywhere on the page to exit the configuration menu.",99 home,100 )101 self.refresh_page()102 def create_subarray(self):103 self.enter_stage(104 self.add_tour_step,105 "Let us create a simple subarray containing 4 antennas, CBF and SDP.",106 title="Create a subarray",107 )108 subarray = '//*[@id="ui-view-container-div"]/div/div[1]/div/div[1]/div/button[1]'109 self.click(subarray)110 def test_katgui_tour(self) -> None:111 """KATGUI Tour/Demonstration"""112 self.login_katgui()113 self.disable_alarms()...

Full Screen

Full Screen

tour.py

Source:tour.py Github

copy

Full Screen

...3 def test_google_tour(self):4 self.open("https://cellardoor.info")5 self.wait_for_element('span[class="block text-emerald-600 xl:inline"]')6 self.create_tour(theme="introjs")7 self.add_tour_step("Platform de gestion de flotte")8 self.add_tour_step("Pour se connecter", 'a[href="/login"]')9 self.play_tour()10 11 self.click('a[href="/login"]')12 self.wait_for_element("#email")13 14 self.create_tour(theme="introjs")15 self.add_tour_step("On va se connecter en tant que gestionnaire")16 self.add_tour_step("Identifiants : Email", 'input[id="email"]')17 self.play_tour()18 19 self.create_tour(theme="introjs")20 self.type("#email", "gestionnaire@emsi.ma")21 self.add_tour_step("Identifiants : Mot de passe", 'input[id="password"]')22 self.play_tour()23 self.type("#password", "azerty")24 25 self.create_tour(theme="introjs")26 self.click('button[type="submit"]')27 self.wait_for_element('p[class="block px-3 py-2 rounded-md text-base font-medium text-gray-700"]')28 self.add_tour_step("Infos : Nom complet de l'utilisateur et son role", 'p[class="block px-3 py-2 rounded-md text-base font-medium text-gray-700"]')29 self.add_tour_step("Cout des pannes par Km", 'img[src="/data/cout_reparations_par_km.png"]')30 self.add_tour_step("Cout des amendes par Km", 'img[src="/data/cout_amendes_par_km.png"]')31 self.add_tour_step("Total frais voyages par année", 'img[src="/data/frais_voyages_par_annee.png"]')32 self.add_tour_step("Pourcentage des vehicules en panne", 'img[src="/data/vehicules_en_panne.png"]')33 self.add_tour_step("Données des voyages", 'a[class="block px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:text-gray-900"]')34 self.play_tour()35 36 self.create_tour(theme="introjs")37 self.click('a[href="/dashboard/voyages"]')38 self.wait_for_element('h1[class="text-3xl mx-4"]')39 self.add_tour_step("Ajouter un voyage", 'a[href="/dashboard/voyages/create"]')40 self.add_tour_step("Rechercher un voyage", 'input[class="border px-2 w-1/4 rounded-lg"]')41 self.add_tour_step("Actions possibles pour un voyage", 'td[class="flex py-4 justify-center"]')42 self.play_tour()43 44 self.create_tour(theme="introjs")45 self.click('a[href="/dashboard/users"]')46 self.wait_for_element('h1[class="text-3xl mx-4"]')47 self.add_tour_step("Gestion des Utilisateurs : Chauffeurs, Gestionnaires, Collaborateurs", 'h1[class="text-3xl mx-4"]')48 self.play_tour()49 50 self.create_tour(theme="introjs")51 self.click('a[href="/dashboard/vehicules"]')52 self.wait_for_element('h1[class="text-3xl mx-4"]')53 self.add_tour_step("Gestion des Vehicules", 'h1[class="text-3xl mx-4"]')54 self.add_tour_step("Se déconnecter", 'button[class="block px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:text-gray-900"]')55 self.play_tour()56 57 self.create_tour(theme="introjs")58 self.click('button[class="block px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:text-gray-900"]')59 self.wait_for_element('img[class="h-8 w-auto sm:h-10"]')60 self.click('a[href="/login"]')61 self.wait_for_element("#email")62 self.create_tour(theme="introjs")63 self.add_tour_step("On va se connecter en tant que chauffeur")64 self.add_tour_step("Identifiants : Email", 'input[id="email"]')65 self.play_tour()66 67 self.create_tour(theme="introjs")68 self.type("#email", "chauffeur@emsi.ma")69 self.add_tour_step("Identifiants : Mot de passe", 'input[id="password"]')70 self.play_tour()71 self.type("#password", "azerty")72 73 self.create_tour(theme="introjs")74 self.click('button[type="submit"]')75 self.wait_for_element('p[class="block px-3 py-2 rounded-md text-base font-medium text-gray-700"]')76 self.add_tour_step("Infos : Nom Chauffeur et son role", 'p[class="block px-3 py-2 rounded-md text-base font-medium text-gray-700"]')77 self.add_tour_step("Voyages du chauffeur", 'h1[class="text-3xl mx-4"]')78 self.add_tour_step("Se déconnecter", 'button[class="block px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:text-gray-900"]')...

Full Screen

Full Screen

bootstrap_google_tour.py

Source:bootstrap_google_tour.py Github

copy

Full Screen

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

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run SeleniumBase automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful