Stop process after the last index

Hello everyone ,
am using in my process a loop with decision flow , i wanted the get text to keep reading value one after anotheruntil the last value in a table which the lenght is changing so i can’t know the lenght before …
i want that when my process arrive in the last index to not throw exception ,
cause when it’s arrive in the last index the exception “Get Text : Element not found” is thrown so how can i stop after reaching the last index
any solutions please ?
Thanks

you can add elementexists activity before the get text activity. based on boolen response perform to exit or continue to get text activity

  • elementexists
  • if condition
    true - get text flow
    false - exit or other business logic…
1 Like

Thank you for the reply , i will try it
but if i left else section blank , is the exception will be thrown ?
and also how to make the exit ? which activity i can use ?

I thought to use terminate workflow activity but i want to end the workflow without any pop up exception , any idea ?

Thanks

Hy @Mery_EL,

What is the condition on your flow decision?
Are you reading data from a text file and loop thought
The rows?

Regards

Iam reading the names from a table in a webpage
the get text has a dynamic selector “idx.ToString” so i can loop throught…
the condition is if the text extracted is equal a specific string it will extract the informations corresponding to that extracted text if Not the index get incremented and return to get the next text in the next row
btw i used before data scraping but its doesn’t work for me that’s why i made this workflow

Thanks

Hy @Mery_EL,

In understood you could not find the last row of the data table.

I suggest you put your worflow process inside a try / catch block, when an item is not found the process would stop with no crashes

Have a look

Regards

Thank you , in the catch section should i put terminate workflow ?
if i did mention an exception in the catch section it’ll be thrown i guess so i just want to stop the process !!

Hi @Mery_EL,

If you are reading data from html table in Webpage?

Yes in javascript we can get row count.

var x = document.getElementById(“myTable”).rows.length;

Regards,
Omkar P

1 Like

I tried it before , yes from html table in webpage
the get row count was empty every time i wanted to test it

Hi @Mery_EL

You can try using data scraping which will give you datatable and later you use for each row activity to loop in for all records, It also have pagination feature which can be used to navigate to other pages having same data format.

If that does not work for you, you can use element exists property, where bot will check for element, If element exists, it can capture it, if not it will give a boolean value as false, in response to that you can define next step of action to be performed,

Hope this helps you.

1 Like

Hy @Mery_EL,

In the catch you dont need a terminate worfklow, you can just put and end message for your workflow. Give it a shot and let me know.

PS: Please TAG me in your answer so I get notified.

Regards

1 Like

Thank you , data scraping does not work for my table
i will try the second solution

Thanks

1 Like

Thank you very mush , i will try your solution

Thanks

Glad I could help @Mery_EL,

If you have any questions please let me know.

If everything is ok please mark my answer as the solution!

image

Thank you!

1 Like

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