GetText Activity throw error when element

Hello,

When I use ‘GetText’ Activity Value is properly obtained when value is available. but when value not available then ‘getText’ activity throw the error and my bot stopped.

What should I do If Value not available then get default value.

Thanks

Hi @Vishal_Prajapati

Try setting the Continue on error to True and initialize the variable with the default value.

image

Hey @kumar.varun2

Thank you for help

hey

you should use a try catch activity, and put inside the get text, so if this activity fails the bot wont stop

Regards!

Hi @Vishal_Prajapati ,

The ideal exception handling method that i think will be as follows ,

  1. use element exists for the element which you think can available and sometimes not
    2.Use an if condition to check the element is available or not, if true then use get text else print no such item is available

HAPPY AUTOMATION !!!

Hello @Krishna_547 ,

You can try different approaches here.

  1. Put the Get text inside a Try catch and continue the flow.
    2)Use an element exists and check the condition using if. If exists then only use Get Text, else use some delay.
  2. Mark continue on Error as true.( Not suggested always)

If you want to wait for the Get text element to appear, you can use Wait for element exist or you can do it with a While loop with a combination of Element Exists.