Wait for element & if based on the element result

Hello, i have this problem when creating my automation flow

So I have an upload process, where the website will give a notification (success/fail) when the upload is complete, it somehow looked like this:
image
This is for success upload, when failed it will show a red box with details on what type of failures.

I want to make the activities to wait for either success or failed notification to appear and then act based on the what element appears.

Already tried element exists activity, but it doesn’t wait for the element to appear and just jump to the next activity (logout).

Any clues on how to solve this?

Thank you in advance.

Hi,

You can use “wait for element appear” activity, although it proved to generate pretty random results at times. I would advise closing “element exists” in a loop, like this:

Does this help?

Cheers
Andrzej

Thank you for the answer
From what i see, this scenario can be used if we expect only one type of element, right?

In my scenario, there are 2 type of element (upload success & upload failed) and i want a different action based on what element appear.

So can i still use this scenario of yours? if yes what i need to modify?

If there are multiple outcomes and you want to handle each, use pick activity, then inside this activity use a “PickBranch” activity for each outcome,

for my example below it will output a different message depending on whether excel window or explorer window pops up first

You could try what Jack proposed, although you would still need to loop it somehow.

You could also put two “element exists” activities inside the loop, saving the output to two different boolean variables. Then you exit the loop if any of them is true, and check which one happened with an “if” afterwards, like this:

If you do this though, remember to set the timeout of “element exists” to something very short, possibly even zero, to avoid the loop taking too long.

Hope that helps.

Cheers
Andrzej

Thank you @jack.chan & @Andrzej_Kinastowski

I can run the element exist now without problem using @Andrzej_Kinastowski solution
And 1 more question. When I used the “If uploadsuccess = true” when I try to move excel file that are uploaded to different folder, I always get an error like this

I already used kill process to kill excel process, but still the file cant be moved? is there any solution to this?

What did you put in the “Move file\From” field? This part looks suspicious to me.

I put the directory of the files & sort it based on the modified time and pick the files

it worked for me in the previous sequence, but more often than not failed at this sequence

Pls copy and paste the code that begins with Directory.GetFiles. I think there’s somethign wrong there.
Why would you use the GetFiles, if you already know the name of the file you want to move? Can’t you just paste the full path there?

Cheers
Andrzej

I can’t, because we have several files that are always downloaded with random names, so I use getfiles to get the last modified files in that folder

Well, in this case, are you 100% sure that you are trying to move the right file? I presume you do something like Directory.GetFiles(“xxx”)(0)?

Taking the latest file is risky, as some other app could have saved something in the temp folder in the meantime.

The first thing I would do is to put a log before you try to move the file, with he same expression you put in “From:”, just to see whether you are trying to move the right file, and not some random temp file.

Cheers
Andrzej