I’m using a chrome extension for web security which presents html popup messages which is generated locally. How can I search/scan these popup messages for content. In the example below I open google.ir and get the following popup message. I’ve tried several approaches but always get error messages since it doesn’t open the actual url that was entered. Current log showing errors is at the bottom. Note: I had to change the url’s in the log to get around the new user restriction of two links in a post.
Yes, it is a popup from a web extension that is intercepting my request to go to the original url. I want to scan the popup for ‘Web Page Blocked’ for this particular url. For other url’s the page might say something different. This is the beginnings of a Policy Test script to ensure security policies are working.
I had everything working in iMacros but had to sit and watch it for the desired results. Same here, but eventually I would like to have this script run on several machines and gather the results for display on an Ops dashboard (Selenium?).
Note that during test and macro run I move the IDE to the left (outside desktop screen) so that the OCR does not pick up the word “RISK” in the IDE. I want it to find the work RISK inside the popup screenshot. In production, you can avoid that by minimizing the IDE with BringIDEandBrowserToBackground
OCRExtractRelativeText explained:
The values Risk#R-8,25H10W35 mean to search for the word “Risk” and then, from the center of this word, go 8 to the left and 25 up. At this position take a screenshot of a rectangle area with height=10 and width=35. Then Ui.Vision runs local OCR on this image, and stores the result in variable a.
How to find these values? => Start with an educated guess, and press “FIND” to test it. Based on the result, refine the values. Rinse and repeat until you have moved the green screen scraping rectangle to the right place
However, now the script errors on all the open url commands? When in Desktop mode can you not open url’s? Also, if I have the extension Block Page displayed in the browser (like in my screenshot) the echo only shows [echo] text=$(a) and not Web Page Blocked.
I changed the parenthesis to curly brackets and now get [echo] text=
Note that the OPEN command (and any other web browser only command) is not displayed in the command dropdown in “Desktop mode”, but the commands itself work fine.
That could mean that the OCR extraction returned “” (empty string). To debug this, have a look at the last_screenshot image in the “Screenshots” tab. It shows the input that is OCR processed. Is it the right area?
Are you hiding/covering the Ui.Vision IDE during macro run? Otherwise it could be the the OCR word is found inside the IDE instead of on the desktop. The last_screenshot image hints that this is happening…
I saw that in my screenshot when you pointed it out. I ran it again making sure the IDE was further over to the left so that Risk wasn’t showing and it did the same thing.