Error Using "If" Activity in UI Automation Then Branch Doesn't Trigger

I’m trying to automate the retrieval of documents from the Seattle Municipal Court interface. In particular, I want to download the police reports. The reports appear in a standard format on a table as “Declaration - Police Report,” but there are often multiple pages of proceedings, and the police report is on the last page or second to last.

So far, I have configured it to Ctrl-F search for "police report, and I have an “If” activity setup so that whenever the result equals “1,” it’s set to identify the row that the file is on, click on it, and download the file. The Else branch is set to Click the “Next” button and repeat the Ctrl-F operation until it hits the police report.

Since I’m not sure how to repeat the Else branch until it succeeds (also could use help on that if someone knows), I have repeated the copy pasted the the If-Then-Else series inside the Else branch eight times to cover most scenarios.

When I tested it, everything worked to a point. It opened the page, searched for the police report, and clicked through all the pages until it found the police report, but it didn’t execute the “Then” branch (download the file) as expected.

It gives me the following error:

Activity Click ‘Next page’ (N Click) failed: The target element is disabled. Operation canceled.

I surmise that this is because it’s at the end of the results and the “Next” arrow is disabled, but I can’t understand why it didn’t trigger the “Then” branch to run.

It’s likely a problem further up the chain. I created a write line for the Get Text Activity immediately before where the Error occurred, and the output is “0/0” instead of “1/1” as is expected.I think my Get Text isn’t configured correctly. I was having a hard time setting anchors for it, but I assumed it was working because it was correctly outputting “0/0” earlier.

I feel like I’m so close to figuring this out, but I could use a little push to get in the right direction.

You can use flow chart activity
And based on the value you get you can set Boolean flag to true or false in flow decisions activity

Now if it’s true add you further steps
If false
Redirect it from there to next button click
Here u can check if button is enabled or grayed out and then u can add click
Also while redirected you else part add counter also
Else it will never stop till is getting result for police search @justindward

@justindward

Try to increase the time out in the Get text activity and give a try.
And check the selectors as well whether its correctly captured or not.

Thanks!

Those are great suggestions. I thought that might fix it, but I increased the “Delay Before” and the “Timeout” to 15 seconds and no luck.

Here’s a screenshot of my “Get Text” properties

I also tried playing with the selectors, and I think they are correct. I switched both of the anchors to “image” and anchored it to the up and down arrows. It’s now validating at 100%. I also switched it from Strict to Fuzzy.

That’s about all I can think to do. Do you know if there’s a workaround or an activity that let’s you search for things on a web browser page without automating Ctrl-F? That would make this a lot simpler.

Thanks again!

Thanks! I’ll try that.

1 Like

Hey @justindward try the retry activity and inside pass that get text activity and also as you can see in the property panel of Wait For page text choose (Complete)and also there are many propert try it one time . hope it help to get the text .
The image displays a software UI for configuring input parameters, including scraping method, targeting methods, visibility check, and wait for page load settings. (Captioned by AI)

and if get text not give you the result can you try with Get Ocr text.

cheers Happy Automation

In the title and ctrl name: try to make it dynamic using the *
i.e keep which ever is constant as it is and add * followed by that.

Try to fetch the aaname or inner text and remove the automationid

thanks,

Hi Sumit,

Thank you for the suggestion. I tried playing around with all those properties like you said and didn’t have any luck, so I tried the “Get OCR Text” activity and got this error after setting it up to target the “Find in Page” results counter.

image

I think it could be because the “1/1” counter isn’t an image but I’m not sure. It’s text but I can’t highlight it with my mouse cursor, so I don’t know.

Hi Naveen, I think that’s on the right track because it’s still reading 0/0 regardless of whether the results say 1/1.,

I changed the ctrl name to “/”, but that didn’t work by itself unless you mean to change it somewhere besides the selector. I’m not sure what you mean by “fetch the aaname or inner text” Could you please clarify on that part. It currently says "automationid=’ ’ " so I’m not sure if you mean I should remove that string altogether. It seems like there is no automationid.

image

Thank you so much for taking the time to consider my questions.

@justindward ok do one thing first try to clear that and write the variable again because i faced the same glitch many time and when i clear and write that again it work for me . if the thing not work go to the Import Section and check the NameSpace that have installed or not .
The image displays a list of imported namespaces in a development environment with "System.Drawing" circled in orange. (Captioned by AI)

cheers Happy Automation.

@justindward

Please send the screen shot of UiExplorer so we can guide you on that

I’ll do that and post it tomorrow. Thanks!