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

Blogs

Check out the latest blogs from LambdaTest on this topic:

Feeding your QA Career – Developing Instinctive & Practical Skills

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.

A Complete Guide To CSS Grid

Ever since the Internet was invented, web developers have searched for the most efficient ways to display content on web browsers.

Keeping Quality Transparency Throughout the organization

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.

A Detailed Guide To Xamarin Testing

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.

How To Run Cypress Tests In Azure DevOps Pipeline

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.

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