How to use voltar method in SeleniumBase

Best Python code snippet using SeleniumBase

funcionarios.py

Source:funcionarios.py Github

copy

Full Screen

1from tkinter import *2from functools import partial3from tkinter import messagebox4import gestor5import sqlite36def voltar_click(frame, ctrl):7 frame.destroy()8 if ctrl==0:9 gestor.show_frame()10 else:11 show_frame()12def registrar(frame, nome, rg, entrada_h, entrada_min, saida_h, saida_min, user, pwd):13 if nome.get()=="" or rg.get()=="" or user.get()=="" or pwd.get()=="":14 messagebox.showinfo("Erro", "Preencha todas as informações!")15 else:16 if not all(x.isalpha() or x.isspace() for x in nome.get()) or not rg.get().isdigit():17 messagebox.showinfo("Erro", "Nome ou RG inválido!")18 else:19 conn = sqlite3.connect('dados/database.db')20 c = conn.cursor()21 c.execute('SELECT * FROM funcionarios WHERE rg=?', (rg.get(),))22 result = c.fetchone()23 if result is not None:24 messagebox.showinfo("Erro", "RG já cadastrado!")25 else:26 entrada = entrada_h.get()+":"+entrada_min.get()27 saida = saida_h.get()+":"+saida_min.get()28 c.execute('INSERT INTO funcionarios (nome, rg, entrada, saida) VALUES(?, ?, ?, ?)',29 (nome.get().upper(), rg.get(), entrada, saida))30 conn.commit()31 c.execute('INSERT INTO usuarios (user, password, acesso, rg) VALUES(?, ?, ?, ?)',32 (user.get(), pwd.get(), 0, rg.get()))33 conn.commit()34 messagebox.showinfo("Cadastro de Funcionários", "Funcionário cadastrado com sucesso!")35 voltar_click(frame, 1)36def consultar(rg, nome, entrada, saida):37 nome["text"] = ""38 entrada["text"] =""39 saida["text"] = ""40 conn = sqlite3.connect('dados/database.db')41 c = conn.cursor()42 c.execute('SELECT * FROM funcionarios WHERE rg=?', (rg.get(),))43 result = c.fetchone()44 if result is not None:45 nome["text"] = result[0]46 entrada["text"] = result[2]47 saida["text"] = result[3]48 return 149 else:50 messagebox.showinfo("Consulta de Funcionários", "Nenhum funcionário encontrado!")51 return 052def deletar(rg, nome, entrada, saida, excluir):53 conn = sqlite3.connect('dados/database.db')54 c = conn.cursor()55 result = messagebox.askyesno("Exclusão de Funcionários", "Confirmar exclusão do funcionário?")56 if result:57 c.execute('DELETE FROM funcionarios WHERE rg=?', (rg.get(),))58 conn.commit()59 c.execute('DELETE FROM usuarios WHERE rg=?', (rg.get(),))60 conn.commit()61 messagebox.showinfo("Exclusão de Funcionários", "Funcionário excluído com sucesso!")62 else:63 messagebox.showinfo("Exclusão de Funcionários", "Exclusão cancelada")64 rg["text"] = ""65 nome["text"] = ""66 entrada["text"] = ""67 saida["text"] = ""68 excluir["state"] = DISABLED69def encontrar(rg, nome, entrada, saida, excluir):70 if consultar(rg, nome, entrada, saida) == 1:71 excluir["state"] = NORMAL72 else:73 excluir["state"] = DISABLED74def cadastrar_click(frame):75 frame.destroy()76 action = Tk()77 Label(action, text="Cadastrar Funcionário", font=("Arial", 24)).grid(row=0, column=1, columnspan=3, ipadx=30, pady=20)78 # Nome79 nome_label = Label(action, text="Nome:", font=("Arial", 12))80 nome_label.grid(row=1, column=0, pady=5, sticky=E)81 nome = Entry(action, font=("Arial", 12))82 nome.grid(row=1, column=1, columnspan=3, sticky=W + E)83 # RG84 rg_label = Label(action, text="RG:", font=("Arial", 12))85 rg_label.grid(row=2, column=0, pady=(5, 10), sticky=E)86 rg = Entry(action, font=("Arial", 12))87 rg.grid(row=2, column=1, columnspan=3, sticky=W + E)88 # Horário de Entrada89 entrada_label = Label(action, text="Entrada:", font=("Arial", 12))90 entrada_label.grid(row=8, column=0, pady=5, sticky=E)91 entrada_h = Spinbox(action, font=("Arial", 12), from_=0, to=23, format="%02.0f", state="readonly", width=2)92 entrada_h.grid(row=8, column=1, sticky=W)93 entrada_min = Spinbox(action, font=("Arial", 12), from_=0, to=59, format="%02.0f", state="readonly", width=2)94 entrada_min.grid(row=8, column=1)95 # Horário de Saída96 saida_label = Label(action, text="Saída:", font=("Arial", 12))97 saida_label.grid(row=9, column=0, pady=5, sticky=E)98 saida_h = Spinbox(action, font=("Arial", 12), from_=0, to=23, format="%02.0f", state="readonly", width=2)99 saida_h.grid(row=9, column=1, sticky=W)100 saida_min = Spinbox(action, font=("Arial", 12), from_=0, to=59, format="%02.0f", state="readonly", width=2)101 saida_min.grid(row=9, column=1)102 # Usuario103 user_label = Label(action, text="Usuário:", font=("Arial", 12))104 user_label.grid(row=10, column=0, pady=5, sticky=E)105 user = Entry(action, font=("Arial", 12))106 user.grid(row=10, column=1, columnspan=3, sticky=W)107 # Senha108 pwd_label = Label(action, text="Senha:", font=("Arial", 12))109 pwd_label.grid(row=11, column=0, pady=(10, 5), sticky=E)110 pwd = Entry(action, font=("Arial", 12))111 pwd.grid(row=11, column=1, columnspan=3, sticky=W)112 # Botão confirmar113 confirmar = Button(action, bg="gray75", text="Confirmar", font=("Arial", 12))114 confirmar["command"] = partial(registrar, action, nome, rg, entrada_h, entrada_min, saida_h, saida_min, user, pwd)115 confirmar.grid(row=12, column=1, pady=5, sticky=W)116 # Botão Voltar117 voltar = Button(action, bg="gray75", text="Cancelar", font=("Arial", 12))118 voltar["command"] = partial(voltar_click, action, 1)119 voltar.grid(row=13, column=1, sticky=W, ipadx=3)120 action.title("Gerenciamento de Cinema")121 action.geometry("490x380+500+150")122 action.iconbitmap(r'icones/icon.ico')123 action.mainloop()124def consultar_click(frame):125 frame.destroy()126 action = Tk()127 Label(action, text="Consultar Funcionário", font=("Arial", 24)).grid(row=0, column=1, padx=30, pady=20)128 # RG129 rg_label = Label(action, text="RG:", font=("Arial", 12))130 rg_label.grid(row=1, column=0, pady=5, sticky=E)131 rg = Entry(action, font=("Arial", 12))132 rg.grid(row=1, column=1, sticky=W+E)133 # Nome134 nome_label = Label(action, text="Nome:", font=("Arial", 12))135 nome_label.grid(row=2, column=0, pady=5, sticky=E)136 nome = Label(action, text="", font=("Arial", 12))137 nome.grid(row=2, column=1, sticky=W)138 # Horário de Entrada139 entrada_label = Label(action, text="Entrada:", font=("Arial", 12))140 entrada_label.grid(row=3, column=0, pady=5, sticky=E)141 entrada = Label(action, text="", font=("Arial", 12))142 entrada.grid(row=3, column=1, sticky=W)143 # Horário de Saída144 saida_label = Label(action, text="Saída:", font=("Arial", 12))145 saida_label.grid(row=4, column=0, pady=5, sticky=E)146 saida = Label(action, text="", font=("Arial", 12))147 saida.grid(row=4, column=1, sticky=W)148 # Botão Consultar149 consultar_bt = Button(action, bg="gray75", text="Consultar", font=("Arial", 12))150 consultar_bt["command"] = partial(consultar, rg, nome, entrada, saida)151 consultar_bt.grid(row=5, column=1, pady=10, sticky=W)152 #Botão Voltar153 voltar = Button(action, bg="gray75", text="Voltar", font=("Arial", 12))154 voltar["command"] = partial(voltar_click, action, 1)155 voltar.grid(row=6, column=1, sticky=W, ipadx=12)156 action.title("Gerenciamento de Cinema")157 action.geometry("490x310+500+150")158 action.iconbitmap(r'icones/icon.ico')159 action.mainloop()160def excluir_click(frame):161 frame.destroy()162 action = Tk()163 Label(action, text="Excluir Funcionário", font=("Arial", 24)).grid(row=0, column=1, padx=35, pady=20)164 # RG165 rg_label = Label(action, text="RG:", font=("Arial", 12))166 rg_label.grid(row=1, column=0, sticky=E)167 rg = Entry(action, font=("Arial",12))168 rg.grid(row=1, column=1, sticky=W+E)169 # Nome170 nome_label = Label(action, text="Nome:", font=("Arial", 12))171 nome_label.grid(row=2, column=0, sticky=E)172 nome = Label(action, text="", font=("Arial", 12))173 nome.grid(row=2, column=1, sticky=W)174 # Entrada175 entrada_label = Label(action, text="Entrada:", font=("Arial", 12))176 entrada_label.grid(row=3, column=0, sticky=E)177 entrada = Label(action, text="", font=("Arial", 12))178 entrada.grid(row=3, column=1, sticky=W)179 # Saida180 saida_label = Label(action, text="Saida:", font=("Arial", 12))181 saida_label.grid(row=4, column=0, sticky=E)182 saida = Label(action, text="", font=("Arial", 12))183 saida.grid(row=4, column=1, sticky=W)184 # Botão Excluir185 excluir = Button(action, bg="gray75", text="Excluir", font=("Arial", 12), state=DISABLED)186 excluir["command"] = partial(deletar, rg, nome, entrada, saida, excluir)187 excluir.grid(row=6, column=1, pady=10, sticky=W, ipadx=6)188 # Botão Encontrar189 encontrar_bt = Button(action, bg="gray75", text="Encontrar", font=("Arial", 12))190 encontrar_bt["command"] = partial(encontrar, rg, nome, entrada, saida, excluir)191 encontrar_bt.grid(row=1, column=2, padx=5)192 # Botão Voltar193 voltar = Button(action, bg="gray75", text="Voltar", font=("Arial", 12))194 voltar["command"] = partial(voltar_click, action, 1)195 voltar.grid(row=7, column=1, sticky=W, ipadx=8)196 action.title("Gerenciamento de Cinema")197 action.geometry("520x290+500+150")198 action.iconbitmap(r'icones/icon.ico')199 action.mainloop()200def show_frame():201 frame = Tk()202 Label(frame, text="Funcionários", font=("Arial", 24)).grid(row=0, column=0, padx=155, pady=25)203 #Botão Cadastrar204 cadastrar = Button(frame, text="Cadastrar", font=("Arial", 14))205 cadastrar["command"] = partial(cadastrar_click, frame)206 cadastrar.grid(row=1, column=0, pady=20, sticky=W+E)207 #Botão Consultar208 consultar = Button(frame, text="Consultar", font=("Arial", 14))209 consultar["command"] = partial(consultar_click, frame)210 consultar.grid(row=2, column=0, pady=20, sticky=W+E)211 #Botão Excluir212 excluir = Button(frame, text="Excluir", font=("Arial", 14))213 excluir["command"] = partial(excluir_click, frame)214 excluir.grid(row=3, column=0, pady=20, sticky=W+E)215 #Botão Voltar216 voltar = Button(frame, bg="gray75", text="Voltar", font=("Arial", 14))217 voltar["command"] = partial(voltar_click, frame, 0)218 voltar.grid(row=4, column=0, pady=15)219 #Botão Sair220 sair = Button(frame, bg="gray75", text="Sair", font=("Arial", 14), command=frame.destroy)221 sair.grid(row=5, column=0, ipadx=8)222 frame.title("Gerenciamento de Cinema")223 frame.geometry("490x450+500+150")224 frame.iconbitmap(r'icones/icon.ico')...

Full Screen

Full Screen

salas.py

Source:salas.py Github

copy

Full Screen

1from tkinter import *2from functools import partial3from tkinter import messagebox4import gestor5import sqlite36def voltar_click(frame, ctrl):7 frame.destroy()8 if ctrl==0:9 gestor.show_frame()10 else:11 show_frame()12def registrar(frame, numero):13 if not numero.get().isdigit():14 messagebox.showinfo("Erro", "Apenas caracteres numéricos!")15 else:16 conn = sqlite3.connect('dados/database.db')17 c = conn.cursor()18 c.execute('SELECT * FROM salas WHERE sala=?', (numero.get()))19 if c.fetchone() is None:20 c.execute('INSERT INTO salas (sala, status) VALUES(?, ?)', (numero.get(), "Livre"))21 c.execute('INSERT INTO poltronas (sala, livres) VALUES(?, ?)', (numero.get(), 50))22 for index in range(1, 51):23 poltrona = "poltrona" + str(index)24 c.execute('UPDATE poltronas SET {} = ? WHERE sala = ?'.format(poltrona), (0, numero.get()))25 conn.commit()26 messagebox.showinfo("Cadastro de Salas", "Sala cadastrada com sucesso!")27 voltar_click(frame, 1)28 else:29 messagebox.showinfo("Erro", "Sala já cadastrada!")30def consultar(numero, status, resetar_bt):31 status["text"] = ""32 conn = sqlite3.connect('dados/database.db')33 c = conn.cursor()34 c.execute('SELECT * FROM salas WHERE sala=?', (numero.get(),))35 result = c.fetchone()36 if result is not None:37 status["text"] = result[1]38 resetar_bt["state"] = NORMAL39 return 140 else:41 messagebox.showinfo("Consulta de Salas", "Nenhuma sala encontrada!")42 return 043def deletar(numero, status, excluir):44 conn = sqlite3.connect('dados/database.db')45 c = conn.cursor()46 if status["text"] == "Em uso":47 c.execute('SELECT * FROM salas WHERE sala=?', (numero.get()))48 result = c.fetchone()49 message = "Sala em uso. Exclua o filme '"+result[2]+"' antes de excluir a sala!"50 messagebox.showinfo("Atenção", message)51 else:52 confirmar = "Confirmar exclusão da sala?"53 result = messagebox.askyesno("Exclusão de Salas", confirmar)54 if result:55 c.execute('DELETE FROM salas WHERE sala=?', (numero.get(),))56 c.execute('DELETE FROM poltronas WHERE sala=?', (numero.get()))57 conn.commit()58 messagebox.showinfo("Exclusão de Salas", "Sala excluída com sucesso!")59 else:60 messagebox.showinfo("Exclusão de Salas", "Exclusão cancelada")61 status["text"] = ""62 excluir["state"] = DISABLED63def encontrar(numero, status, excluir):64 if consultar(numero, status, excluir) == 1:65 excluir["state"] = NORMAL66 else:67 excluir["state"] = DISABLED68def resetar(numero, resetar_bt):69 result = messagebox.askyesno("Resetar sala", "Deseja resetar todas as poltronas?")70 if result:71 conn = sqlite3.connect('dados/database.db')72 c = conn.cursor()73 for index in range(1,51):74 poltrona = "poltrona"+str(index)75 c.execute('UPDATE poltronas SET {} = ? WHERE sala = ?'.format(poltrona), (0, numero.get()))76 c.execute('UPDATE poltronas SET livres = 50 WHERE sala = ?', (numero.get(),))77 conn.commit()78 messagebox.showinfo("Resetar sala", "Poltronas resetadas!")79 else:80 messagebox.showinfo("Resetar sala", "Reset cancelado")81 resetar_bt["state"] = DISABLED82def cadastrar_click(frame):83 frame.destroy()84 action = Tk()85 Label(action, text="Cadastrar Sala", font=("Arial", 24)).grid(row=0, column=1, pady=20)86 # Número da sala87 numero_label = Label(action, text="Número:", font=("Arial", 12))88 numero_label.grid(row=1, column=0, pady=5, sticky=E)89 numero = Entry(action, font=("Arial", 12))90 numero.grid(row=1, column=1, sticky=W)91 # Informação Capacidade92 Label(action, text="Capacidade:", font=("Arial", 12)).grid(row=2, column=0, pady=5, sticky=E)93 Label(action, text="50 pessoas (padrão)", font=("Arial", 12)).grid(row=2, column=1, sticky=W)94 # Botão Confirmar95 confirmar = Button(action, bg="gray75", text="Confirmar", font=("Arial", 12))96 confirmar["command"] = partial(registrar, action, numero)97 confirmar.grid(row=3, column=1, pady=10, sticky=W)98 # Botão Voltar99 voltar = Button(action, bg="gray75", text="Cancelar", font=("Arial", 12))100 voltar["command"] = partial(voltar_click, action, 1)101 voltar.grid(row=4, column=1, sticky=W, ipadx=3)102 action.title("Gerenciamento de Cinema")103 action.geometry("400x250+500+150")104 action.iconbitmap(r'icones/icon.ico')105 action.mainloop()106def consultar_click(frame):107 frame.destroy()108 action = Tk()109 Label(action, text="Consultar Salas", font=("Arial", 24)).grid(row=0, column=1, pady=20)110 # Número111 numero_label = Label(action, text="Número:", font=("Arial", 12))112 numero_label.grid(row=1, column=0, pady=5, sticky=E)113 numero = Entry(action, font=("Arial", 12), width=15)114 numero.grid(row=1, column=1, sticky=W)115 # Status116 status_label = Label(action, text="Status:", font=("Arial", 12))117 status_label.grid(row=2, column=0, pady=5, sticky=E)118 status = Label(action, text="", font=("Arial", 12))119 status.grid(row=2, column=1, sticky=W)120 # Botão Resetar Poltronas121 resetar_bt = Button(action, bg="gray75", text="Resetar Poltronas", font=("Arial", 12, "bold"), state=DISABLED)122 resetar_bt["command"] = partial(resetar, numero, resetar_bt)123 resetar_bt.grid(row=6, column=1, pady=(0, 10), sticky=W)124 # Botão Consultar125 consultar_bt = Button(action, bg="gray75", text="Consultar", font=("Arial", 12, "bold"))126 consultar_bt["command"] = partial(consultar, numero, status, resetar_bt)127 consultar_bt.grid(row=5, column=1, pady=10, ipadx=31, sticky=W)128 # Botão Voltar129 voltar = Button(action, bg="gray75", text="Voltar", font=("Arial", 12))130 voltar["command"] = partial(voltar_click, action, 1)131 voltar.grid(row=7, column=1, sticky=W, ipadx=47)132 action.title("Gerenciamento de Cinema")133 action.geometry("360x290+500+150")134 action.iconbitmap(r'icones/icon.ico')135 action.mainloop()136def excluir_click(frame):137 frame.destroy()138 action = Tk()139 Label(action, text="Excluir Salas", font=("Arial", 24)).grid(row=0, column=1, pady=20)140 # Número141 numero_label = Label(action, text="Número:", font=("Arial", 12))142 numero_label.grid(row=1, column=0, pady=5, sticky=E)143 numero = Entry(action, font=("Arial", 12))144 numero.grid(row=1, column=1, sticky=W)145 # Status146 status_label = Label(action, text="Status:", font=("Arial", 12))147 status_label.grid(row=2, column=0, pady=5, sticky=E)148 status = Label(action, text="", font=("Arial", 12))149 status.grid(row=2, column=1, sticky=W)150 # Botão Excluir151 excluir = Button(action, bg="gray75", text="Excluir", font=("Arial", 12), state=DISABLED)152 excluir["command"] = partial(deletar, numero, status, excluir)153 excluir.grid(row=3, column=1, pady=10, sticky=W, ipadx=6)154 # Botão Encontrar155 encontrar_bt = Button(action, bg="gray75", text="Encontrar", font=("Arial", 12))156 encontrar_bt["command"] = partial(encontrar, numero, status, excluir)157 encontrar_bt.grid(row=1, column=2, padx=5)158 # Botão Voltar159 voltar = Button(action, bg="gray75", text="Voltar", font=("Arial", 12))160 voltar["command"] = partial(voltar_click, action, 1)161 voltar.grid(row=4, column=1, sticky=W, ipadx=8)162 action.title("Gerenciamento de Cinema")163 action.geometry("360x250+500+150")164 action.iconbitmap(r'icones/icon.ico')165 action.mainloop()166def show_frame():167 frame = Tk()168 Label(frame, text="Salas", font=("Arial", 24)).grid(row=0, column=0, padx=205, pady=25)169 #Botão Cadastrar170 cadastrar = Button(frame, text="Cadastrar", font=("Arial", 14))171 cadastrar["command"] = partial(cadastrar_click, frame)172 cadastrar.grid(row=1, column=0, pady=20, sticky=W+E)173 #Botão Consultar174 consultar = Button(frame, text="Consultar", font=("Arial", 14))175 consultar["command"] = partial(consultar_click, frame)176 consultar.grid(row=2, column=0, pady=20, sticky=W+E)177 #Botão Excluir178 excluir = Button(frame, text="Excluir", font=("Arial", 14))179 excluir["command"] = partial(excluir_click, frame)180 excluir.grid(row=3, column=0, pady=20, sticky=W+E)181 #Botão Voltar182 voltar = Button(frame, bg="gray75", text="Voltar", font=("Arial", 14))183 voltar["command"] = partial(voltar_click, frame, 0)184 voltar.grid(row=4, column=0, pady=15)185 #Botão Sair186 sair = Button(frame, bg="gray75", text="Sair", font=("Arial", 14), command=frame.destroy)187 sair.grid(row=5, column=0, ipadx=8)188 frame.title("Gerenciamento de Cinema")189 frame.geometry("490x450+500+150")190 frame.iconbitmap(r'icones/icon.ico')...

Full Screen

Full Screen

app.py

Source:app.py Github

copy

Full Screen

1from flask import Flask2from calculadora import *3app = Flask(__name__)4@app.route('/')5def index():6 h1 = '<h1> Calculadora Olist </h1>'7 ol = '''8 <ol> 9 <li><a href='/soma'>Somar</a></li>10 <li><a href='/subtracao'>Subtrair</a></li>11 <li><a href='/multiplicacao'>Multiplicacao</a></li>12 <li><a href='/divisao'>divisao</a></li>13 </ol>14 '''15 return f'{h1} {ol}'16@app.route('/soma')17def somar():18 n1 = 3.019 n2 = 5.020 resultado = soma(n1, n2)21 h1 = '<h1> Calculadora </h1>'22 h3 = f'<h3> A soma de 3+5 é : {resultado}</h3>'23 voltar = "<a href='/'>Voltar</a>"24 return f'{h1} {h3} <br /> {voltar}'25@app.route('/subtracao')26def subtra():27 n1 = 3.028 n2 = 5.029 resultado = subtracao(n1, n2)30 h1 = '<h1> Calculadora </h1>'31 h3 = f'<h3> A subtracao de 3-5 é : {resultado}</h3>'32 voltar = "<a href='/'>Voltar</a>"33 return f'{h1} {h3} <br /> {voltar}'34@app.route('/multiplicacao')35def multi():36 n1 = 3.037 n2 = 5.038 resultado = multiplicacao(n1, n2)39 h1 = '<h1> Calculadora </h1>'40 h3 = f'<h3> A multiplicacao de 3*5 é : {resultado}</h3>'41 voltar = "<a href='/'>Voltar</a>"42 return f'{h1} {h3} <br /> {voltar}'43@app.route('/divisao')44def divi():45 n1 = 3.046 n2 = 5.047 resultado = divisao(n1, n2)48 h1 = '<h1> Calculadora </h1>'49 h3 = f'<h3> A divisao de 3:5 é : {resultado}</h3>'50 voltar = "<a href='/'>Voltar</a>"51 return f'{h1} {h3} <br /> {voltar}'...

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