How to use abrir_nova_janela method in SeleniumBase

Best Python code snippet using SeleniumBase

robomain.py

Source:robomain.py Github

copy

Full Screen

1import time2import schedule3from selenium import webdriver4from selenium.webdriver.common.keys import Keys567def bater_ponto():8 matricula = '0336126'9 senha = 'Profano123@'1011 path = "C:\Program Files (x86)\chromedriver.exe"12 driver = webdriver.Chrome(path)1314 driver.get(15 'https://portalth.algarnet.com.br/Algar/Produtos/SAAA/Principal2.aspx?amb_selecionado=0&abrir_nova_janela=N'16 '&eh_mdesigner=N&nome_portal=634C3649335370516551633D')1718 if driver.get('https://portalth.algarnet.com.br/Algar/Produtos/SAAA/Principal2.aspx?amb_selecionado=0&abrir_nova_janela=N'19 '&eh_mdesigner=N&nome_portal=634C3649335370516551633D')20 search = driver.find_element_by_id('txtLogin')2122 time.sleep(1)23 search.send_keys(matricula)2425 search2 = driver.find_element_by_id('txtSenha')26 time.sleep(1)27 search2.send_keys(senha)28 search2.send_keys(Keys.RETURN)29 driver.get('https://portalth.algarnet.com.br/Algar/ASS_MDADOS_CONTROLEJORNADA.aspx')30 time.sleep(2)3132 search3 = driver.find_element_by_id('imagem0')33 search3.click()34 time.sleep(5)35 driver.get('https://portalth.algarnet.com.br/WebPonto/just_user/IncluirMarcacaoOnLine.asp')3637 search4 = driver.find_element_by_id('Button1')38 search4.click()39 driver.quit()404142schedule.every().monday.at('06:00').do(bater_ponto)43schedule.every().monday.at('12:00').do(bater_ponto)44schedule.every().monday.at('13:30').do(bater_ponto)45schedule.every().monday.at('15:00').do(bater_ponto)46schedule.every().wednesday.at('06:00').do(bater_ponto)47schedule.every().wednesday.at('12:00').do(bater_ponto)48schedule.every().wednesday.at('13:33').do(bater_ponto)49schedule.every().wednesday.at('15:00').do(bater_ponto)50schedule.every().thursday.at('05:00').do(bater_ponto)51schedule.every().thursday.at('11:30').do(bater_ponto)52schedule.every().thursday.at('12:30').do(bater_ponto)53schedule.every().thursday.at('14:00').do(bater_ponto)54schedule.every().friday.at('05:00').do(bater_ponto)55schedule.every().friday.at('11:30').do(bater_ponto)56schedule.every().friday.at('12:30').do(bater_ponto)57schedule.every().friday.at('14:00').do(bater_ponto)5859while 1:60 schedule.run_pending() ...

Full Screen

Full Screen

desafio_encontrando_elementos.py

Source:desafio_encontrando_elementos.py Github

copy

Full Screen

1from selenium import webdriver2from selenium.webdriver.chrome.options import Options3class elementos:4 def __init__(self):5 chrome_options = Options()6 chrome_options.add_argument('--lang=pt-BR')7 self.driver = webdriver.Chrome(8 executable_path=r'./chromedriver.exe', options=chrome_options)9 def Iniciar(self):10 self.driver.get("https://cursoautomacao.netlify.app/")11 paragrafo = self.driver.find_element_by_xpath("//*[contains(text(), 'Parágrafo')]")12 drop_or_classic = self.driver.find_element_by_xpath("//*[contains(text(), 'Dropdown') or contains(text(), 'Clássico')]")13 elem_and_btn = self.driver.find_element_by_xpath("//*[contains(text(), 'Elementos') and contains(text(), 'botões')]")14 abrir_nova_janela = self.driver.find_element_by_xpath("//*[contains(text(), 'Exemplo abrir Nova Janela')]")15 id_botao = self.driver.find_element_by_xpath("//*[@id='divBotao']")...

Full Screen

Full Screen

punch_in_chrome.py

Source:punch_in_chrome.py Github

copy

Full Screen

1from selenium import webdriver2import time3senha = input("Insira sua senha: ")4browser = webdriver.Chrome()5main_page = browser.current_window_handle6browser.get('https://portalth.algarnet.com.br/Algar/Produtos/SAAA/Principal2.aspx?amb_selecionado=0&abrir_nova_janela=N&eh_mdesigner=N&nome_portal=634C3649335370516551633D')7browser.find_element_by_xpath('//*[@id="txtLogin"]').send_keys('0337770')8browser.find_element_by_xpath('//*[@id="txtSenha"]').send_keys(senha)9browser.find_element_by_xpath('//*[@id="btnEntrar"]').click()10time.sleep(10)11browser.get('https://portalth.algarnet.com.br/Algar/ASS_MDADOS_CONTROLEJORNADA.aspx')12time.sleep(10)13browser.find_element_by_xpath('//*[@id="imagem0"]').click()14time.sleep(10)15for handle in browser.window_handles:16 if handle != main_page:17 login_page = handle18browser.switch_to.window(login_page)...

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