PYTHON - RPA - Wait PROCESSING window to continue automation process

Asked

Viewed 52 times

0

I am automating the generation of reports in a web system, SAP. In this process I use python, with the libraries: Selenium and rpa.

I was able to find the fields to enter the information, however, after clicking "Run", a small window appears in the center of the screen, written "Processing". As long as this window is open it is a sign that you have not finished generating the report.

I would like to put something like "while ('processing') in my code: pause..."

And after this window closes, continue processing.

Below is a part of my code, in which some elements of the web page I found with Selenium, others with rpa...

from selenium import webdriver
import rpa as r
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


# 1 - abrindo o navegador
navegador  = webdriver.Chrome()

# 2 - Navegando até o BO
navegador.get("http://123456/BI")

# 3 -Logando
WebDriverWait(navegador, 10).until(EC.frame_to_be_available_and_switch_to_it((By.NAME,'servletframe')))
WebDriverWait(navegador, 10).until(EC.element_to_be_clickable((By.ID, 'logon:USERNAME'))).send_keys('meuusuario')
navegador.find_element_by_id('logon:PASSWORD').send_keys("123")
WebDriverWait(navegador, 10).until(EC.element_to_be_clickable((By.ID, 'logon:logonButton'))).click()

#usando rpa para inserir os dados para executar o relatório...

r.init(visual_automation = True,chrome_browser = False)

r.type('assets/CodigoEmpresa.png', '123')
r.click('assets/Executar.png')

#aqui entraria a parte que não sei fazer:
#encontrei essa função present, mas não sei se é assim que usa. 
#Não achei um exemplo no github da rpa..
while (present('Processando.png')):
 pause

#continuando código

This is the window that opens while the report is generated:

inserir a descrição da imagem aqui

And below is a piece of code I found with F12 in the browser:

<table role="dialog" aria-labelledby="ariaLabelledBy_waitDlg" oncontextmenu="_CW.eventCancelBubble(event);return false" border="0" cellspacing="0" cellpadding="0" id="waitDlg" style="display: block; padding: 0px; visibility: visible; position: absolute; top: 179px; left: 558px; width: 250px; height: 150px; z-index: 1005;"><tbody><tr><td style="width:250px;height:150px;" class="dialogbox" id="td_dialog_waitDlg" onresize="_CW.DialogBoxWidget_resizeIframeCB('waitDlg',this)" valign="top"><table class="dlgBox2" width="100%" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td height="0" valign="top"><table style="height:26" class="dlgTitle" width="100%" border="0" cellspacing="0" cellpadding="0"><tbody><tr valign="top" style="height:26px"><td onselectstart="return false" ondragstart="return false" onmousedown="_CW.DialogBoxWidget_down(event,'waitDlg',this,false);return false;" style="cursor:move;padding-left:10px;" width="100%" valign="middle" align="left"><nobr><span id="ariaLabelledBy_waitDlg" class="titlezone">Executando consulta</span></nobr></td></tr></tbody></table>

XPATH which would be an option: //*[@id="waitDlg"], also does not locate.

I’d like to check with rpa the image inserir a descrição da imagem aqui

While it exists, it stands waiting, after disappearing it is that finished the preparation of the report.

  • I wish I could improve this question!!! I don’t see how

  • it is possible to verify the existence of this window that indicates the processing through Lenium?

  • It disappears, I can’t press F12 and inspect the element name.

1 answer

1

I just tried the obvious and I got it.

To check if the popup is still on the screen, I entered the command:

while(r.present('Assets/Running.png')): r. Wait(5)

I believe you may have better solutions! But also, it will help someone who needs.

If someone needs to locate an element id use a program:

Accessibility Insights For Windows

When you click on any object on your screen, the automation id is displayed if you have name, class and other properties if you have.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.