Wait until window is visible (Desktop/Universal Driver)

How can I do to have a time of grace without using an implicit wait (like ‘sleep(5000)’) while there is a bot trying to open a new desktop window?

For example:

  1. Open Notepad++
  2. Select File/Open
  3. Open File window is opened. In this step is where I want to wait.

In a webapp, I’m using the following code:

WebDriverWait wait = new WebDriverWait(roboticsDriver.getWrappedObject(), 10);

wait.until(ExpectedConditions.presenceOfElementLocated(byXpath("//[@id=‘create-invoice’]/form")));*

Thanks,

Hi @mgutierrez,
Could you please clarify if you use RPA Express or SPA?

Yes, sorry. I´m using RPA Express for testing.

Once it works fine, I will deploy it in SPA.

Thanks,

Any idea?

Thank you!

Hi @mgutierrez
I’m not sure I can assist you here, as I’m not into writing code. Maybe you can search for some info on the internet.
It seems like you can use custom script written on groovy.

Thanks iostapuk. So, who could assist me?

I’m writting the following code:
inDesktop {
sendKeys(StringTransformations.getHotKeyText(0, 4));
sendKeys(StringTransformations.escapeAutoitText(“seguide.exe”));
}
pressEnter();

sleep(7000);
sendKeys(Keys.chord(Keys.ALT, “a”));

I want to change the “sleep(7000)” function for “window is visible/able to click”.

Thanks in advance

Hi @mgutierrez,
If you know the name (part of the name) of the window which will appear, you can try to switch to the window till it appears:

inDesktop {
     switchToExistingWindow(new WindowDescriptor("", "(?i).\\QInbox\\E.", false, true).toString(), 20000)
}

inDesktop {
     $("[CLASS:NetUIRibbonButton; NAME:New Email]").click()
}
1 Like