Macro stops when open a new tab or open a URL

Hi, I have a simple macro with the browser having only one tab, then opens one URL and all works fine, then open a new tab and here comes the issue. Sometimes the new tab is opened and macro continues, and sometimes the macro simply stops without a timer, without showing error.

If you see my image below, the macro stopped in line 15 and at top of image only appear “Stop” and “Pause” buttons. So, was not a “Pause” event triggered by me and “Resume” button is not present either.

In this scenario, I need to click in stop button since gets freeze. I mean, never changes its state and no error or timeout appears.

This issue happens from time to time, not only with “SelectWindow | tab=open | URL”, but happens with “open | URL” too.

image

@admin Maybe you can give me a suggestion of how to handle this issue please.

@ulrich @admin @Plankton Sorry bother you. Do you have some tip, suggestion, workaround for this issue?

Thanks

same issue, script stops when open url in indefinite looping.
I use version 9.1.6

1 Like

Hello,

Sorry for intruding, I used 9.1.6 before. These are annoying issues [sic], while rare, appear more unexpectedly than the spanish inquisition. I believe that there’s two of them and work in tandem:

  1. UI.Vision appear to fail to get the Page Load signal from the tab and erroneously assumes that the webpage has timed out loading (or failed entirely, if timeouts are disabled) even if it is loading correctly. That is, the open command just incorrectly fails or fails in a timeout.

  2. On rare occasions when the stars align, UI.Vision just hangs execution when selecting or attaching to any tab, sometimes even to the current tab.

I suspect that this is rare because it require specific conditions (which we do not know) to activate and it is likely that the site they are loading causes the issues.


The first problem with open can create infinite retry loops. It has a janky workaround by re-implementing the open command via UI.Vision+JS using window.location and pause | 100 | then the waitForPageToLoad command.


The second problem is tricky to workaround, as we don’t actually know what exactly is happening within the code that causes UI.Vision to fail to attach, (or search for the locator, as the error message suggest?)


Here is a test macro where UI.Vision shows similar symptoms as the original poster, using selectWindow but hangs and not showing any timeout other than the “Stop” and “Pause”. Although, as of 9.1.9, it does timeout after 30 seconds.

Initial Conditions before testing:

  1. Machine is disconnected from the Internet.
  2. UI.Vision hasn’t been started, edited, or ran any macros yet. If so, simply, close then re-open Ui.Vision.
{
  "Name": "Dubious Test",
  "CreationDate": "2024-5-7",
  "Commands": [
    {
      "Command": "selectWindow",
      "Target": "tab=open",
      "Value": "",
      "Description": "This can stall for no reason and timeout to 30 seconds instead of the default 60"
    },
    {
      "Command": "open",
      "Target": "https://awebsitethatdoesnotexist.xyw",
      "Value": "",
      "Description": "Most often this just timeout but fail to get the error that the browser gets."
    },
    {
      "Command": "selectWindow",
      "Target": "tab=open",
      "Value": "https://example.co",
      "Description": "Also another site that does not exist and may also stall for no reason."
    }
  ]
}

For some reason, modifying or rerunning the macro may let it count to the timeout. Not sure if disconnecting internet helps increase the likelihood of replicating the symptom.

1 Like

Thanks for answer and share some workarounds.

Trying this command isolated, seems to work, pending for me to to try it in actual macros.

executeScript | window.location.href = ‘http://www.somesite.com’; |

But a few days ago I tried this other command

executeScript | window.open(http://www.somesite.com’); |

And doesn´t work. It is executed but it doesn´t do anything. Is this a bug?

Regards

Nope, it is as designed. That innocuous line of JS was abused about a decade ago by intrusive ads.

Besides the fact that you used instead of ', this JS code has definitely trip your browser’s pop-up blocker which blocked the new tab and make it look like nothing is happening.

You could add an exception to your browser, perhaps? But do so to your discretion.

If you can’t get it run with the latest version I would roll back to kantu version 8.3.9. That seems the latest stable version. It does not have the side panel implemented, though.
There is an instruction here somewhere on this forum how to roll back to an older version.

Thanks for answer. I’m not an experimented JavaScript programmer, I didn’t know about the issue with windows.open(). I searched a way to open a new tab using JavaScript due to the bug with “selectWindow|tab=open|URL” and saw that didn’t work either.

Then, do you know a workaround to open a new tab?

If I use XType I can use the chrome shortcut “CTRL+T” but even I can open a new tab with that shortcut, I cannot use it to load a URL since the IDE shows the error that is not connected to that new tab.

Regards

Thanks @noahhath for tis suggestion. Is good to know it. I hope not many features are missing in that version

I have this same issue whereby the macro simply freezes when: SelectWindow | tab=open | URL

Is there any way to “ignore error” when this happens? (Btw, the usual ignore error command didn’t help to get it to continue running)