Robot thinks it is stuck in loop but executes next steps twice

Hello everyone,
I am facing a weird problem with my robot.
Below is the sequence I have created.

When I execute it, the robot gets stuck in the ‘For Each Row in DT Unique Groups’ (or thinks it is stuck).
Then while stuck in the loop, it starts executing the next steps of creating the excel file and then starts scraping the web data.
And once again it does the same and creates the excel file and starts scraping web data when it exits the ‘For Each Row in DT Unique Groups’

Image of the sequence below for reference.

I hope you guys can help me figure out what’s wrong with my robot.

Why do you think the robot thinks it’s stuck? Is there an error message?

You can try adding logs inside the loop (ideally with an index) to see if you’re really stuck and if yes, where.

HI @T0Bi ,
I think it is stuck at the ‘For Each Row in DT Unique Groups’ because I have created a loop start and loop end variable to calculate the time it takes for the loop to run.
Right after the loop, I have the write line activity that should give me the time it took for the loop to iterate through all the rows (There might be thousands of rows in the loop. Which is why I feel the robot thinks it is stuck).
After the Write Line activity, there is a write range activity followed by a read range activity.
Then the read range is fed into a for each loop again to scrape web data for each row.

When running the robot in debug mode, I can see the execution start.
Then as per the sequence, I should see the time for the loop to iterate from the write line activity. After which the excel file should be written and opened, followed by the browser launching and looping through each row from the new excel file and scraping the web data.

However, what I am seeing in the logs is the execution start. No output from the write line activity on the time time taken. But the excel file gets written and opened. The browser launches and starts scraping the data for each row in the new excel file.

After some time, the excel file gets opened again and a new browser is launched and data starts getting scraped from the 1st row again. That is why I think the robot thinks that it is still stuck in the loop but for some reason, the next steps start getting executed. Then once the robot finishes the loop, the next steps are executed again from the beginning.

I am having some trouble with web scraping part where the selectors aren’t working properly so the execution automatically stops when an error is encountered.

Even when the execution has stopped, I don’t see the output from the write line.

I hope this gives you an idea of why I think the robot is stuck.

I find it highly unlikely that activities after the write line get executed without the write line getting executed.

Set one breakpoint at the write line activity, another one at the Excel Application scope, then run everything in debug.

It should be impossible for the break point at excel application scope to trigger without stopping at the write line activity first.

Assuming it stops at the write line activity, you a) know that it’s not stuck and b) can check why the write line doesn’t write anything.

Additionally, I’d advice you on using log message instead of write line. You can use log level trace for development/debugging logs.