Using If/else on a webpage

I’m having two road blocks when coming to If/else.
I need the bot to go to a website, and IF there isn’t any filters already, click ADVANCED (This is the first issue I am facing).
The other issue is, the website saves the last filter you used, so if you run the bot to add the filters, and the filters are already what I wanted, then it doesn’t work.

How can I put the bot to:

  • If there is filters already, skip the “click advanced.”
  • If the filters are the same as needed, skip the “add filter” and just click search

Thank you

hi @NathaliaFawcett

Welcome to the Community! :slight_smile:

So you can use check app state and check for filters if they are already in place.
If they are you can simply ignore and move forward.

Hi Adiijaiin,

Thank you for your reply, I believe this is what I was looking for.

Hi @NathaliaFawcett ,
Use an Element Exists activity to check if the filters are already applied.
If the filters exist:
1.Use activities to extract the current filter values:
2.Use activities like “Get Text” or “Get Attribute” to extract the current filter values
from the webpage elements.
3.Store the extracted filter values into variables.
4.Compare Filter Values:
4.1 Check if the current filter values match the required filter values
Use conditions to compare the current filter values stored in variables with
the required filter values.
4.2 If the filter values do not match, then Use a Click activity to click on the
“Advanced” button.
Add activities to apply the required filters.

Else the filters do not exist:
Use a Click activity to click on the “Advanced” button.
Add activities to apply the required filters.
Use a Click activity on the search button.

Hope this helps .

1 Like

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