Search code examples
rpauipathuipath-studio

UiPath: How to kill pop-up window in Firefox?


My issue is that I am not able to close pop-up window in Firefox.

The part of automized process is that robot clicks on button "print" and the portal opens new window in Firefox. After saving of file (which is successful) I am not able to close the window with printed file to keep just the original page.

I tried to capture it by recording (Close tab) which does not work at all (error) and send there a Hotkey "ctrl+w" which closes the original page.

Comparing pages in UiExplorer I do not see any difference except url.


Solution

  • This is where selectors come into play (learn more about them here). Another browser window is likely to have a different title - use a Close Window activity with the appropriate selector. Here's an example:

    close window with selector

    And here's the selector for my example. Note that you can use the wildcard character (might be needed in case parts of the title will change as you print different documents).

    "<html app='firefox.exe' title='Rugby World Cup 2019 - Google Search' />"
    

    The same with a wildcard. This would now work for the 2020 World Cup as well.

    "<html app='firefox.exe' title='Rugby World Cup*' />"
    

    Keep in mind that UiPath will take the first application with a matching selector, so you want a unique one.