Best Python code snippet using SeleniumBase
winquiz.py
Source: winquiz.py
1import time2print("Questo programma serve a calcolare qual è la tua versione preferita di windows classico.")3print()4versioni = ["1.x", "2.x", "3.x for workgroups", "3.x non-for workgroups", "95", "98", "ME", "NT 3.x", "NT 4.x", "2000", "XP"]5daCancellare = []67def rispostaAffermativa(prompt):8 return input(prompt).lower()[0] in ("s", "y")9def cancellaSeCe(lista, elem):10 ls2 = lista[:]11 while elem in ls2:12 ls2.remove(elem)13 return ls21415if rispostaAffermativa("Do you like colors? "):16 daCancellare.append("1.x")17else:18 print("\nFor you, Windows 1.x")19 input("\nPress a key to exit...\n")20 raise SystemExit2122if rispostaAffermativa("Do you like high resolutions? "):23 daCancellare.append("1.x")24 daCancellare.append("2.x")25 daCancellare.append("3.x")26else:27 daCancellare.append("95")28 daCancellare.append("98")29 daCancellare.append("ME")30 daCancellare.append("NT 4.x")31 daCancellare.append("2000")32 daCancellare.append("XP")33if rispostaAffermativa("Do you like staying at home? "):34 daCancellare.append("NT 3.x")35 daCancellare.append("NT 4.x")36 daCancellare.append("2000")37 daCancellare.append("3.x for workgroups")38else:39 daCancellare.append("1.x")40 daCancellare.append("2.x")41 daCancellare.append("3.x non-for workgroups")42 daCancellare.append("95")43 daCancellare.append("98")44 daCancellare.append("ME")45if rispostaAffermativa("Do you want to work at home and in the office with the same PC? "):46 daCancellare.append("1.x")47 daCancellare.append("2.x")48 daCancellare.append("3.x not-for workgroups")49 daCancellare.append("95")50 daCancellare.append("98")51 daCancellare.append("ME")52 daCancellare.append("NT 3.x")53 daCancellare.append("NT 4.x")54 daCancellare.append("2000")55 daCancellare.append("3.x for workgroups")56else:57 daCancellare.append("XP")5859if rispostaAffermativa("Do you use only programs included with Windows, usually? "):60 daCancellare.append("95")61 daCancellare.append("98")62 daCancellare.append("ME")63 daCancellare.append("2000")64 daCancellare.append("XP")65else:66 daCancellare.append("1.x")67 daCancellare.append("2.x")68 daCancellare.append("3.x for workgroups")69 daCancellare.append("3.x non-for workgroups")70 daCancellare.append("NT 3.x")71 daCancellare.append("NT 4.x")72if rispostaAffermativa("Do you like the original, old Ms-dos (16-bit text mode Microsoft system)? "):73 daCancellare.append("NT 3.x")74 daCancellare.append("NT 4.x")75 daCancellare.append("ME")76 daCancellare.append("2000")77 daCancellare.append("XP")78else:79 daCancellare.append("1.x")80 daCancellare.append("2.x")81 daCancellare.append("3.x for workgroups")82 daCancellare.append("3.x non-for workgroups")83 daCancellare.append("95")84 daCancellare.append("98")85if rispostaAffermativa("Do you like blue screen of death? "):86 daCancellare.append("1.x")87 daCancellare.append("2.x")88 daCancellare.append("3.x for workgroups")89 daCancellare.append("3.x non-for workgroups")90 daCancellare.append("NT 3.x")91 daCancellare.append("NT 4.x")92 daCancellare.append("2000")93 daCancellare.append("XP")94else:95 daCancellare.append("98")96 daCancellare.append("95")97 daCancellare.append("ME")9899print("\nWorking.... ")100for vers in daCancellare:101 versioni = cancellaSeCe(versioni, vers)102 time.sleep(0.5)103 print("Still working")104print("fatto")105106if len(versioni) == 0:107 print("I cannot find the correct version for you. Try Windows 10.")108 input("\nPress a key to exit...\n")109 raise SystemExit110else:111 print("\nVersions: \n")112 for x in versioni: print("Windows "+x)113 input("\nPress a key to exit...\n")
...
metodi_predefiniti.py
Source: metodi_predefiniti.py
1nome = "Adrian Medina"2#print(type())3print("\n### type() ###")4print(type(nome))5#isinstance(): detetta il il tippato6print("\n### isinstace() ###")7controlla = isinstance(nome, str)8if controlla:9 print("La variabile è di tipo string")10else:11 print("Non è di tipo string")12if not isinstance(nome, float):13 print("Si, il nome non è di tipo float")14else:15 print("Stranamente il nome è di tipo float")16#strip17print("\n### strip() ###")18testo_per_strip = " Jingle Bells "19print(testo_per_strip)20print(testo_per_strip.strip())21#del22print("\n### del() o del x ###")23cancellare = 202024print("Ancora presente: "+str(cancellare))25del cancellare26#print(cancellare)27#len28print("\n### len() ###")29lunghezza = "Merry Christmas!"30if len(lunghezza) <= 0:31 print("Vuoto")32else:33 print("La lunghezza della variabile è:", len(lunghezza))34#find35print("\n### find() ###")36stella = "stella"37find_position_string = "La stella di natale guida all'incontro con il bambino"38print(find_position_string, f"\nRicerca: \"{stella}\"")39print("La posizione della stella cercata è:",find_position_string.find(stella))40#replace41print("\n### replace() ###")42replacing = "Il Natale è bello"43print(replacing)44print(replacing.replace("Natale", "monopattino"))45#lower() y upper()46print("\n### lower e upper ###")47frase = "Frosty the Snowman"48print("Original:",frase)49frase_maiusc = frase.upper()50print("Upper:\t ",frase_maiusc)51frase_minusc = frase.lower()...
dataset_selection_COCO.py
Source: dataset_selection_COCO.py
1import glob2import json3import os4data_dir = "/home/tobi/Documents/tirocinio_montini/dataset_1_6-09-2021/"5with open(data_dir + 'annotations/instances_default.json', 'r') as f:6 dict = json.load(f)7with open(data_dir + 'selection_images.txt', 'r') as f:8 listaimg = f.read().splitlines()9immagini_da_cancellare = glob.glob(data_dir+'images/*.jpg')10for immagine_da_tenere in listaimg:11 img = glob.glob(data_dir+'images/image'+immagine_da_tenere+'.jpg')12 immagini_da_cancellare.remove(img[0])13for c, img in enumerate(immagini_da_cancellare):14 os.remove(img)15 immagini_da_cancellare[c] = img.replace(data_dir+'images/', '')16for immagine in immagini_da_cancellare:17 for c, image in enumerate(dict["images"]):18 if image["file_name"] == immagine:19 print(immagine)20 del dict["images"][c]21ids = []22for image in dict["images"]:23 ids.append(image["id"])24for c, ann in enumerate(dict["annotations"]):25 if ann["image_id"] not in ids:26 del dict["annotations"][c]27with open(data_dir+'annotations/coco_annotations.json', 'w') as f:...
Check out the latest blogs from LambdaTest on this topic:
The QA testing profession requires both educational and long-term or experience-based learning. One can learn the basics from certification courses and exams, boot camp courses, and college-level courses where available. However, developing instinctive and practical skills works best when built with work experience.
Ever since the Internet was invented, web developers have searched for the most efficient ways to display content on web browsers.
In general, software testers have a challenging job. Software testing is frequently the final significant activity undertaken prior to actually delivering a product. Since the terms “software” and “late” are nearly synonymous, it is the testers that frequently catch the ire of the whole business as they try to test the software at the end. It is the testers who are under pressure to finish faster and deem the product “release candidate” before they have had enough opportunity to be comfortable. To make matters worse, if bugs are discovered in the product after it has been released, everyone looks to the testers and says, “Why didn’t you spot those bugs?” The testers did not cause the bugs, but they must bear some of the guilt for the bugs that were disclosed.
Xamarin is an open-source framework that offers cross-platform application development using the C# programming language. It helps to simplify your overall development and management of cross-platform software applications.
When software developers took years to create and introduce new products to the market is long gone. Users (or consumers) today are more eager to use their favorite applications with the latest bells and whistles. However, users today don’t have the patience to work around bugs, errors, and design flaws. People have less self-control, and if your product or application doesn’t make life easier for users, they’ll leave for a better solution.
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!!