I can't understand why this function enter into a infinite loop as show in the Logs screenshot below ?!!!!
This only happens in run mode. In record mode everything working as expected !!!
I discovered what happens: I need to load at least one url before loading the custom js functions. I loaded http://example.com before the custom js functions worked fine in "Run Mode".