How to Skip the getText if the desired text is not present?

I am extracting various texts from the website using GetText activity and then writing it inside Excel using Write Range, but sometimes the desired text is not available for a certain GetText activity

How can I deal with this situation?

Check the text before writing using string functions. (String.contains or string.isnullorempty if you need to check if string is empty before writing).

Hey! @Sami_Rajput ,

Check whether the text is present in the variable or not using if activity or Assign Activity.

Using If:

  1. Drag and drop if activity and then in the condition check like this.

In then block use one assign activity and provide this

GetTextVariable = "Text is Not Availabe"

in else block take one more assign activity and do the following

GetTextVariable = GetTextVariable

Using Assign:

Take one assign activity and do this

GetTextVariable = if(String.IsNullOrEmpty(GetTextVariable),
                                 "Text is Not Available",

That’s it.

You can use either of the one.


1 Like

Hi @Sami_Rajput ,

Use Element exist activity to check if the desired text in the website is available. if it is available element exist returns true so that we can use get text activity to get the desired text or else we can send exception email saying that desired text not available.

another method is we can create variable to store the desired text from get text activity if not found we could use default value feature of variable to store the generic text like Desired text nor found.


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