Does ImageExists work on image files, or arbitrary sections of the screen?

I am not clear if ImageExists works only on image files, or if it works on arbitrary sections of the screen. How do I do the latter?

I tried it, and it didn’t detect a javascript popup. Not too many options, so idk what went wrong.

1 Like

Hi
Image exists works for the image specified in any application and use that here inside EITHER ATTACH WINDOW or GET ACTIVE WINDOW activity
Cheers @Robot.Builder.9001

That sounds like the help file, and does not answer my question.

I’m working in a browser at the moment, but if I were working in a random program, I (as in my program) still might need to look at it and then do something based on what I (as in the program) see.

Hi @Robot.Builder.9001,

It just checks if the image appears in the screen. You just select the region of anything and if that shows up it will return a boolean like true or false.

Could you explain what you mean by the activity working “on image files”?

As mentioned above, the activity will look for the specified image anywhere on the screen (or rather, withing the specified area of the screen which you specify with a selector) and will return a boolean if found.

If it didn’t work on your Java script popup, you might want to broaden the selector a bit.

1 Like

An image is more commonly known as a picture, pic, or image file. Formats include jpg, jpeg, png, bmp, and many others.

Browsers load html files and image files and display them in your browser (oversimplified, but you get the idea).

The documentation leads me to believe that the activity can (and will only) grab the image file from the browser, compare it, and make a determination.

Normal programs do not display image files, they have a GUI (graphical user interface) that is not nearly as malleable as a browser’s, nor as programmatically generated, nor are its elements as inspectable. Therefore, for this activity to work in regular programs, the activity cannot just work on image files from a browser.

It’ sounds like you’re trying to clarify things, but you’re keeping the status quo.

What I want is for the activity to grab a portion of the screen, compare it, and make a determination. How can I make it do that, regardless of what images are displayed in a browser (or program)?

I see now :smiley: Well, this activity takes an image as input and compares it with a screencap of your entire screen (or just the part that you specified in your selector, i.e. app window or browser window, helps with performance).

So it doesn’t really look for any particular image file, but rather for it’s presence in another image.

Feel free to suggest an improvement to wording for the documentation, it will get clarified :slight_smile:

OK, so it sounds like this is the activity I want to use. Step 0 accomplished lol

Since I’ve already tried it and it’s not working, how do I troubleshoot this thing?

I am not sure what to fiddle with to get this thing working, see below. I’ve swapped out the Microsoft OCR engine for Tessaract (Google), but get the same results.

Do I need to take a snippet and load it to the activity, or does the screen selection tool take care of that?

It takes care of that.

Could you give it a try with a target selector set to the browser window? I noticed it misbehaves when I don’t have any selector set and returns True even though the Notepad app is closed.

This works:

It returns True when my Notepad is on the foreground and False when it is minimized (which is the expected behaviour).

Some things to try then:

  • try removing the grey part of the image and only provide the inside of the checkbox
  • try playing around with the Accuracy setting and the profile setting
  • try to increase the Timeout a bit just in case

I tested it on the UiAutomation package 19.12.0.

I tried making the screenshot bigger, then smaller. It’s now smaller, see below.

The Selector section doesn’t have the GUI based selector editor (until you paste one in there (only realized that when pulling the text for this forum post)), so I copied and pasted the firefox selector from a previous activity. It now has "<html app='firefox.exe' />"

Nothing has affected the problem yet.

The ImageExists activity keeps/leaves the variable at false, which you can see over on the left in my log. Because it never detects the popup, my error comes later, in the else side of another activity where it can’t find the button that it would expect.

For reference, here’s what happens down the stack.

Just to get on the same page, could you try out this sample project and let me know if it works?
It should click the Try It button and then close the popup after some time.


TestingImageExists.zip (10.5 KB)

Why are we moving from “using an activity properly” to “testing a webpage’s popup technology”?

Just to have a shared point of reference. Starting small to find the culprit

OK, so I pouted about this for a day or so (and stayed busy at work), and figured, oh what the hell, I’ll try the file.

Based on the screenshot you provided, and your confirmation, I was expecting an HTML file with a javascript modal that I would then have to write a test case for in UIPath. After I downloaded the file, I saw it was a UIPath xaml file. I was like “ok, wtf we talked about something completely different on the board, but this works out better.”

Interestingly, it took a while to “import dependencies”, so I wonder if I was missing some prereqs for activities or something.

The first time it ran, it didn’t push the button to bring up the popup. I ran it a few more times, and then it would push the button. At first I didn’t think it was going to close it, but apparently I just needed to wait awhile.

I switched your xaml file over to Firefox, fiddled with it a little bit, and I was able to retain it in the new browser. However, the selectors were able to detect the pupup as a scope, and the button. Which is unlike what I’m finding on the test site.

And I got a notification on this thread that someone thinks it’s a firefox plugin issue: How to work with Javascript modals (pop ups)?

I indeed wanted to be on the same page in terms of activity packages versions. The Studio version is decoupled from the activity packages, which means that sometimes simply updating the UiPath.UIAutomation.Activities might fix UI automation related issues.

Indeed, the activity works based on a timeout you set in properties. It waits until the timeout ends and then decides if the image was find within that time or not. The default timeout seems to be 3 seconds which explains the delay.

This might be. Now that we know it works for other browser, we can look into the Firefox case.

To debug it, I installed the Firefox extension for my Firefox and tried to find selectors for the same popup, see below:

This is on Studio 2019.12.0-beta.61 with Firefox 72.0.2 (64-bit) and extension version:
image
and the activity packages as follows:

Could you let us know the details of your environment?

I noticed some packages could use an update, so I told them to update.

As an aside, how do you permanently disable the checkbox to include prerelease?

uipath version



firefox version



IE 11

I’ve left the chunk of code that works in Firefox alone, but for the chunk that had the problem, I’m trying to get IE 11 to execute it. However, it seems I’m getting a strage fatal error and the debug is failing.

I noticed that .NET is an older version, so I’ll try updating that, but I’m not holding my breath.

The problem is that UIPath can’t properly manipulate the save/save as button in the download bar. I see other people complaining about that, but no solutions look especially effective.

I’m trying to save as to a specified folder. I might be able to get by with saving to the default directory, but I’d prefer not to.

Starting 19.12 Preview, we have released Chrome/Firefox popup support. Would it be helpful for this scenario?

1 Like

JavaScript modals are as old, or older, than UIPath. I was not aware of any limitations for any particular browser and though that the extensions were all at feature parity.

Where did I miss it in the training classes, release notes, blogs, marketing, etc. that UIPath has up until now not supported JavaScript Modals in non-IE browsers?

Seriously, because apparently I will need to read all of it if there’s a checkerboard of unsupported features on different platforms.

1 Like