Value of Element exist in for loop does not change after every loop

So in my sequence, i have a Element exist activity in my for loop. The element exist activity checks if excel is open and if it is, closes it. However, in my first loop, excel is not open and thus, it skips this step and the boolean for element exist is false, which is correct. However, in the second loop, excel is open but the boolean value is still false, which is not suppose to be the case.

Can someone point out to me what i am doing wrong and why the boolean value isn’t changing?

I would recommend running in debug and stepping through line-by-line. When it gets to the second ‘element exists’ activity and you expect it to be found, make sure that the element does in fact exist. It may be that the selector isn’t found, so the activity is correctly showing false.

An easy way to do this is to use uiexplorer and click the ‘validate’ button to see if the selector is found

1 Like

it’s not that i have 2 different element exist activity, i have only 1, but it is in a for loop. I’ve tested this already in a separate work flow with the exact same indication and it does indeed detect the excel application. It’s just that when it is in the for loop, the boolean value is still false for the second loop when it should be true

maybe you can show us some screenshots from flow.
Give a try on following:
change the scope from output variable (your element exists) to a higher level and test it again

It’s generally a good idea to check that the selector is still valid at that point in time

Just because a selector works in the initial build, doesn’t mean it works at run-time. I would highly recommend following what I suggested. That’s always my first step when I have something like this happen at runtime - if it is working correctly it rules out the selector issue and only takes a minute or two to check.

While you are stepping through the process in debug mode, you can also follow along with the boolean value. Check to see when it flips, when it is initialized, etc. This can help determine if there are naming (2 variables same name) or scope issues (too high or too low of scope for the variable)

I found the solution. All i had to do was go into the selector and uncheck title. I guess it was also looking for the specific title of the excel file thats why it keeps showing false.

@wasd… if your requirement is only to close the Excel… Then no need for all this worries… SImply you can use Kill Process and give “EXCEL” as process name… It will kill the Excel Process if opened and if it is not then control will move to next activity…

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