Best Python code snippet using SeleniumBase
Reto4 - Semana 6 - Variante 1 Solucion con menu.py
...2526 def atras(self, posicion):27 return posicion-12829 def adelante(self, posicion):30 return posicion+13132 def nombrePorPosicion(self, posicion):33 return self.items[posicion]3435 def pilaAnteriores(self, posicion):36 anteriores = []37 for i in range(self.tamano()):38 if (i<posicion):39 anteriores.append(self.items[i])40 return anteriores4142 def pilaAdelante(self, posicion):43 adelante = []44 for i in range(self.tamano()):45 if (i > posicion):46 adelante.append(self.items[i])47 return adelante4849 def __str__(self):50 return str(self.items)5152opc='1'53listaPaginas = Pila()54while(opc!='9'):55 opc = input("1. Agregar a la Pila\n2. Imprimir Pila\n3. Definir pagina Actual\n4. Default Pila\n5. Salir\n")56 if (opc == '1'):57 paginaNueva = input("Direcccion de la pagina? ")58 listaPaginas.incluir(paginaNueva)59 elif (opc == '2'):60 print(listaPaginas)61 elif (opc == '3'):62 posicionPaginaActual = listaPaginas.paginaActual(input("Escriba la pagina a buscar: "))63 pagOpc = '1'64 while(pagOpc!='5'):65 pagOpc = input("1. Mostrar Pilas Anterior y Adelante\n2. Funcion Atras\n3. Funcion Adelante\n4. Salir\n")66 if (pagOpc == '1'):67 print("Pagina Actual: ", listaPaginas.nombrePorPosicion(posicionPaginaActual))68 print("Pila Anteriores: ", listaPaginas.pilaAnteriores(posicionPaginaActual))69 print("Pila Adelante: ", listaPaginas.pilaAdelante(posicionPaginaActual))70 elif (pagOpc == '2'):71 posicionPaginaActual = listaPaginas.atras(posicionPaginaActual)72 elif (pagOpc == '3'):73 posicionPaginaActual = listaPaginas.adelante(posicionPaginaActual)74 else:75 pagOpc = '5'76 elif (opc== '4'):77 listaPaginas.incluir("google.com")78 listaPaginas.incluir("youtube.com")79 listaPaginas.incluir("jw.org/es")80 listaPaginas.incluir("netflix.com")81 listaPaginas.incluir("micasa.com")82 else:
...
variante1.py
Source: variante1.py
1"""2reto 4 - variante 13"""45#NO ELIMINAR LA SIGUIENTE IMPORTACIÃN, sirve para probar tu código en consola6#from pruebas import pruebas_codigo_estudiante7"""NOTAS: 8 -PARA ESTE RETO PUEDES PROBAR TU PROGRAMA, DANDO CLICK EN LA NAVE ESPACIAL9 -LA CONSOLA TE DARà INSTRUCCIONES SI PUEDES EVALUAR O NO TU CÃDIGO10"""111213"""Inicio espacio para programar funciones propias"""14#En este espacio podrás programar las funciones que deseas usar en la función solución (ES OPCIONAL1516def pilaAtras(pila_atras,cad):17 return pila_atras.append(cad)1819def pilaAdelante(pila_adelante,cad):20 return pila_adelante.append(cad)2122"""Fin espacio para programar funciones propias"""2324def actualizar_estado_pestana(operaciones_usuario, pagina_default):25 #ESTA ES LA FUNCIÃN A LA QUE LE DEBES GARANTIZAR LOS RETORNOS REQUERIDOS EN EL ENUNCIADO.26 27 pagina_actual = pagina_default28 pila_atras = []29 pila_adelante = []30 31 for i in operaciones_usuario:32 33 if i == "atras":34 pilaAdelante(pila_adelante, pagina_actual)35 pagina_actual = pila_atras.pop()36 37 elif i == "adelante":38 pilaAtras(pila_atras, pagina_actual)39 pagina_actual = pila_adelante.pop()40 41 else:42 if(i != pagina_actual):43 pilaAtras(pila_atras, pagina_actual)44 pagina_actual = i45 pila_adelante = []4647 48 return pila_atras, pagina_actual, pila_adelante4950"""51NO PEDIR DATOS CON LA FUNCIÃN input(), NO COLOCAR CÃDIGO FUERA DE LAS FUNCIONES QUE USTED CREE52Esta lÃnea de código que sigue, permite probar si su ejercicio es correcto53Por favor NO ELIMINARLA54"""55operaciones_usuario = ["udea.edu.co","ingeniaudea.co","twitter.com", "atras",56"atras", "adelante", "facebook.com", "facebook.com"]57pagina_default = "google.com"5859sal = actualizar_estado_pestana(operaciones_usuario, pagina_default)6061#pruebas_codigo_estudiante(actualizar_estado_pestana)
...
ej4.py
Source: ej4.py
...5 # Ayuda: crear un arreglo de tamaño k, y dos Ãndices para marcar las6 # posiciones de "atrás" y "adelante". ¡Pensar bien las invariantes!7 def esta_vacia(self):8 # HACER: implementar9 def agregar_adelante(self, dato):10 # HACER: implementar11 def quitar_adelante(self):12 # HACER: implementar13 def ver_adelante(self):14 # HACER: implementar15 def agregar_atras(self, dato):16 # HACER: implementar17 def quitar_atras(self):18 # HACER: implementar19 def ver_atras(self):20 # HACER: implementar21def pruebas():22 d = Deque(10)23 assert d.esta_vacia()24 d.agregar_atras(1)25 # [ - - - - 1 - - - - - ]26 # |27 # adelante28 # atras29 assert d.ver_adelante() == 130 assert d.ver_atras() == 131 d.agregar_adelante(2)32 # [ - - - - 1 2 - - - - ]33 # | |34 # atras adelante35 assert d.ver_adelante() == 236 assert d.ver_atras() == 137 d.agregar_atras(3)38 d.agregar_adelante(4)39 d.agregar_adelante(5)40 # [ - - - 3 1 2 4 5 - - ]41 # | |42 # atras adelante43 assert d.ver_adelante() == 544 assert d.ver_atras() == 345 dato = d.quitar_adelante()46 assert dato == 547 # [ - - - 3 1 2 4 - - - ]48 # | |49 # atras adelante50 assert d.ver_adelante() == 451 assert d.ver_atras() == 352 dato = d.quitar_atras()53 assert dato == 354 # [ - - - - 1 2 4 - - - ]55 # | |56 # atras adelante57 assert d.ver_adelante() == 458 assert d.ver_atras() == 159 d.quitar_atras()60 d.quitar_atras()61 d.quitar_atras()62 assert d.esta_vacia()63 from os import path64 print(f"{path.basename(__file__)}: OK")...
Check out the latest blogs from LambdaTest on this topic:
The events over the past few years have allowed the world to break the barriers of traditional ways of working. This has led to the emergence of a huge adoption of remote working and companies diversifying their workforce to a global reach. Even prior to this many organizations had already had operations and teams geographically dispersed.
Automating testing is a crucial step in the development pipeline of a software product. In an agile development environment, where there is continuous development, deployment, and maintenance of software products, automation testing ensures that the end software products delivered are error-free.
Unit testing is typically software testing within the developer domain. As the QA role expands in DevOps, QAOps, DesignOps, or within an Agile team, QA testers often find themselves creating unit tests. QA testers may create unit tests within the code using a specified unit testing tool, or independently using a variety of methods.
In some sense, testing can be more difficult than coding, as validating the efficiency of the test cases (i.e., the ‘goodness’ of your tests) can be much harder than validating code correctness. In practice, the tests are just executed without any validation beyond the pass/fail verdict. On the contrary, the code is (hopefully) always validated by testing. By designing and executing the test cases the result is that some tests have passed, and some others have failed. Testers do not know much about how many bugs remain in the code, nor about their bug-revealing efficiency.
The best agile teams are built from people who work together as one unit, where each team member has both the technical and the personal skills to allow the team to become self-organized, cross-functional, and self-motivated. These are all big words that I hear in almost every agile project. Still, the criteria to make a fantastic agile team are practically impossible to achieve without one major factor: motivation towards a common goal.
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!!