How to click on based on the condition?

Hi All,

I need to perform click operation based on the condition as below:
If the input excel file column(departments) contains TPA Colo, TPA Double, EGDBravo,Physical then I need click on button:“Surgery Outpatient” and need to proceed for further scrapping part.

If the above mention departments are not present means then I need to scarp the data without clicking on “Surgery Outpatient”

Can someone please help me on this??


Hello @HeartCatcher

Can you refer to the below post. This can be easily done with linq and a if condition.

linq to check whether the column contains the items and if to make the condition if exists or not.

Hi! @HeartCatcher,

Hope you’re doing well. Have you tried the below methods…

  1. Take one if condition and check for those keywords if keywords found in then block use click activity.

if conditions looks like

item.eqals("TPA Colo").ToString or item.eqals("TPA Double").ToString or item.eqals("EGDBravo").ToString or item.eqals("Physical").ToString

In else part use the data scraping…

For each surround with Try-Catch in catch block mention Continue


@HeartCatcher Try the below steps

  • Read the input excel file to data table
  • Take if condition and write the below exp
DT.Columns.Contains("TPA Colo") AND DT.Columns.Contains("TPA Double") AND DT.Columns.Contains("EGDBravo") AND DT.Columns.Contains("Physical")
  • DT is the data table name
  • If the condition becomes True then click on Surgery Outpatient else scrape directly

The column name is department what I need to mention??