How to access the warnings window for information not found? (Selenium)

0

In python 3 and selenium webdriver I have this program to insert codes into a website and store the information returned:

from selenium import webdriver

profile = webdriver.FirefoxProfile()
browser = webdriver.Firefox(profile)

# Site que é acessado
browser.get('https://www.fazenda.sp.gov.br/SigeoLei131/Paginas/ConsultaDespesaAno.aspx?orgao=')

# Seleciona o ano 2018
browser.find_element_by_xpath('/html/body/form/div[3]/table/tbody/tr[2]/td/table/tbody/tr[2]/td/table/tbody/tr[1]/td[2]/select/option[1]').click()

# Digita o código 07022473000139
browser.find_element_by_xpath('//*[@id="ctl00_ContentPlaceHolder1_rblDoc_0"]').click()
browser.find_element_by_xpath('//*[@id="ctl00_ContentPlaceHolder1_txtCPF"]').send_keys('07022473000139')
browser.find_element_by_xpath('//*[@id="ctl00_ContentPlaceHolder1_btnPesquisar"]').click()

# Armazena as informações encontradas
company = browser.find_element_by_xpath('/html/body/form/div[3]/table/tbody/tr[2]/td/table/tbody/tr[3]/td/div/table/tbody/tr[2]/td[1]').text
value = browser.find_element_by_xpath('/html/body/form/div[3]/table/tbody/tr[2]/td/table/tbody/tr[3]/td/div/table/tbody/tr[2]/td[2]').text

# Volta uma tela para fazer outra pesquisa
browser.find_element_by_xpath('//*[@id="ctl00_ContentPlaceHolder1_btnVoltar"]').click()

I have a list of codes to search the site in the field: "CNPJ / CPF / Generic Registration / Favored UGE:"

In this list I have already discovered that some codes do not exist in the site database (I do not know how many do not exist). And when I type a code that does not exist (such as '07022473000136') a window will open on the website with the message "There is no creditor with the filter informed" and I can only continue to press the OK button

I did not find this warning message in the site code, so I still do not know how to handle it

Please, would anyone know how to test if the code exists or not with the use of selenium? And if it does not exist, how do I press the OK button to continue?

    
asked by anonymous 12.06.2018 / 14:05

0 answers