How to use play_tour method in SeleniumBase

Best Python code snippet using SeleniumBase

tour.py

Source:tour.py Github

copy

Full Screen

...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

activite3.py

Source:activite3.py Github

copy

Full Screen

...33def choose_name():34 name = input("Quel est ton nom ?")35 name = str(name)36 return name37def play_tour(player, max, lap, lap_data):38 time_begin = round(time.time())39 random_number = random.randint(0, max)40 attempt = 1041 win = False42 print(f'A toi de jouer { player.name } !')43 while attempt > 0:44 user_guess = ask_user(max)45 if user_guess == random_number:46 print("Félicitations ! Vous avez trouvé !")47 print("************* Nouvelle manche *************")48 player.set_won += 149 time_end = round(time.time())50 win = True51 break52 elif user_guess > random_number:53 print(f'C\'est trop grand.')54 else:55 print(f'C\'est trop petit.')56 attempt -= 157 print(f'Il te reste {attempt} essais')58 if not win:59 time_end = round(time.time())60 print("Vous avez perdu.")61 print("************* Nouvelle manche *************")62 time_lap = (time_end - time_begin)63 # update = {"Score": time_lap, "Player": player.name}64 lap_data[str(lap) + ':' + player.name] = {"Score": time_lap, "Player": player.name}65def main():66 # Choix des noms des personnages67 name_player1 = choose_name()68 player_1 = Player(name_player1, 5)69 name_player2 = choose_name()70 player_2 = Player(name_player2, 5)71 # Initialisation du dictionnaire qui stocke les données de chaque tour72 lap_data = {}73 lap = 174 # Choix du niveau de difficulté75 max = choose_level()76 while lap <= 5:77 play_tour(player_1, max, lap, lap_data)78 play_tour(player_2, max, lap, lap_data)79 print(lap_data)80 lap += 181if __name__ == '__main__':...

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