If-else 3 conditions

hi all
I am trying to get price from website.
there would be 3 possible conditions

  1. price found
  2. price not available
  3. page not found

I managed to get the first 2 condition working, i tried using another if activity but got lost. any advice?

You can use element exist activity for 3rd condition then apply if else.
Else part would be above sequence
Hope it will help

Happy automation

1 Like

Hi @hanna1

You can either use element exists or get text activity to check whether the page is not available.

However i do not recommend having nested if conditions as a practise. You can combine these conditions in a single if activity.

For example:

(PageAvailable and priceFound) or (PageAvailable and Not PriceFound)

In the if activity Then part can have all stuff related to price if you use the above condition. Else part will have how you handle the page not found.

If you really want to have them as separate conditions one after the other, its a good idea to use a flowchart activity and use flow decision activities. It is much more readable and friendly

Hope it helps

1 Like

Thanks, sir.
I got another question here.

In my another workflow, i have only 2 condition which should work well with if else.
I am using amazon as example,

  1. get the price (assume all has price) &
  2. page not found (ie…wrong url)

It is able to fetch all the price but once it reaches a page not found, it stopped.error is element not exist. What was it that i did wrong in the steps?


Your workflow here looks fine to me. Can you add a break point to element exists there and execute.in debug mode? You can add a break point by right clicking on the activity and clicking on add break point.

Execute it in debug mode. Once it reach this activity it will stop. Then do a step by step execution so that you can see what element exists returns when page is not found. And see to which component it goes in the if condition when page is not found. Just do a run and see. Then you will be able to easily locate the activity which is faulty :slight_smile:

1 Like

Thank, found it.
In my actual workflow (which is a vendor’s site), i have added a “click” activity.
Upon clicking, then “element exist” (price).
So if a page is not found, it can’t find the “click” activity

In such case, what should i do?

1 Like

Easiest way is to add another element exists activity for the button you are clicking. Just like what you have for the price.

Or else, more suitable one would.be to first check whether the page is found. So basically if page is not found it displays page not found something right. So you can use a element exists activity to check whether the page not found thing is what you have on screen. Then use if condition,

If page found
Perform the click and get the price like what you have now.
If page not found do nothing :slight_smile:

1 Like

Thanks so much! It finally work!:star_struck:

1 Like

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