Scenario handling/ if condition

Hi everyone. I face difficulty dealing with this task. Basically, I need to call the robot to download the files (see 1st picture below) from a website for its further handling. In this case, when I hit the “Download” green button in the right bottom corner, a download message box (see the 2nd picture) will show up and the robot can download it to proceed.

However, there might be times where there is no file to be downloaded (see the 3rd picture), and in this case, when I hit the “Download” green button in the right bottom corner, a new page (see the 4th picture) will show up to let us know that no files are available for download.

If this case (no files available) happens, I would use the Go Back activity under Brower to let the robot do something else in the website. I am struggling to build the flow in which the robot knows to go back in the case where no files are available… I am not sure how the if condition activity may help or if there are any better way to solve the problem… Please help, many thanks!!

1st pic
Files available

2nd pic

3rd pic
Files unavailable

4th pic
Files unavailable 2

Hi,

Go back

You have an activity for that called Go Back. If this is not working for you (for example you have a redirection at a form “posting”, you never know…) you can get the url before clicking (myBrowser.Element.Get(“url”).ToString then use the Navigate To activity.

Detecting the case

You’re probably able to detecct fast enough the “No Qulaifying Record […]” message when no download available (find it with proper timeout). If no detected, search for the save as options and if not detected, go back and do something else

Alternative approach

From what I see, before clicking on the download button, you have a table with or without any row.

  • Check if table has any row (with Element Exists or trying to scrap its data for example)
  • Use previous result as condition for your decision (download or do something else)
1 Like

Hi… sorry for the late feedback. Go Back is not a concern for me. It works fine. The problem is that the robot can’t know when they are cases and when they aren’t. I just tried a few methods with the use of Element Exists but they don’t really work.

I am not sure what you mean by detecting the case… detect by using Element Exists? Thank you.

Hello @wth1993

Your first screenshot displays a table with policies. Your third screenshot shows no policy.

Can you get a Selector for the first policy cell (with the green link)? Maybe something like <webctrl tableCol='1' tableRow='1' tag='TD' /> or <webctrl tableCol='1' tableRow='2' tag='TD' />?With a reliable selector, an ElementExists will allow to know the case. It might be enough to find if a first row of data is here (probably with something like <webctrl tag='TR' idx='1' /> or <webctrl tag='TR' idx='2' />.

I can only guess the selector from your informations, if you need more details, please provide a detailed UiExplorer image with the first row selected and another with the first cell.

3 Likes

Hi @wth1993,

Have you tried element exist if the " No Qualify record …" As seen in the 4 screenshot.

So the flow for download remains the same , after the click of the download button ,we take an element exist of "No Qualify record … "

If true - that means no record and go back


Mukesh

Thanks all. I just solved the problem. In the Element Exists activity, I indicated the drop down select under the Reason Code Column to judge whether there is any policy, then use If activity to set if this = true, proceed to download, else Go Back.

It turns out that I just needed to wait for longer time (20 sec) in the case where there is no policy. Thanks!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.