UI Vision is becoming deadly slow after running loop

Hello Team,
I am running a while loop on the website to find a specific text. The loop continues until a specific text is visible on the website. The loop exits only when the text is visible.

so the loop may continue for hours to find the text. However, after running for 15-20 minutes, it’s becoming slow… When the loop iteration increases, it keeps on slowing down…

Is there any fix for this issue or am I doing something wrong?

I have shared the loop coding below

Thanks

    {
      "Command": "storeText",
      "Target": "id=ContentPlaceHolder1_lblMsg",
      "Value": "available",
      "Description": ""
    },
    {
      "Command": "while",
      "Target": "${available} === '' || (${available} && ${available}.indexOf('No seats available') !== -1) || (${available} && ${available}.indexOf('Please select class') !== -1)",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "select",
      "Target": "id=ContentPlaceHolder1_DropDownList",
      "Value": "label=Select Class",
      "Description": ""
    },
    {
      "Command": "pause",
      "Target": "200",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "select",
      "Target": "id=ContentPlaceHolder1_DropDownList",
      "Value": "label=${class}",
      "Description": ""
    },
    {
      "Command": "pause",
      "Target": "200",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "id=ContentPlaceHolder1_lblMsg",
      "Value": "available",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    }

Can you please test if the same issue happens if you run the macro in the side panel?

Hi,
Thanks for the suggestion.

The issue is still there even if we run in the side panel. I have tried it on multiple machines with different configurations.

I understand that it is not a machine issue as while running the UI vision, the resource usage is less than 20%

Are there any other suggestions to fix this issue?

Thanks in advance!

Hi, I have two suggestions:

  1. Please try with store | nodisplay | !replayspeed - does adding this help?

  2. Also, can you please run the below test macro and check if it shows the same problem?

The macro runs a TIMES loop and outputs the run time (performance) of each loop.

{
  "Name": "performance_test1",
  "CreationDate": "2024-2-19",
  "Commands": [
    {
      "Command": "store",
      "Target": "fast",
      "Value": "!replayspeed",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "${!runtime}",
      "Value": "runtime_old",
      "Description": ""
    },
    {
      "Command": "times",
      "Target": "5000",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return parseFloat(${!runtime}) - parseFloat(${runtime_old});\n",
      "Value": "t",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "${!runtime}",
      "Value": "runtime_old",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "${!times}: ${!runtime}, DELTA = ${t}",
      "Value": "green",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    }
  ]
}

Thanks for the response.

I am already using store | nodisplay | !replayspeed

I have run the macro you provided; below is the output of the same!

[echo]
21: 7.25s, DELTA = 0.25
[echo]
22: 7.58s, DELTA = 0.2600000000000007
[echo]
23: 7.91s, DELTA = 0.25
[echo]
24: 8.24s, DELTA = 0.2400000000000002
[echo]
25: 8.57s, DELTA = 0.25
[echo]
26: 8.89s, DELTA = 0.2400000000000002
[echo]
27: 9.24s, DELTA = 0.25
[echo]
28: 9.57s, DELTA = 0.2400000000000002
[echo]
29: 9.96s, DELTA = 0.27999999999999936
[echo]
30: 10.35s, DELTA = 0.28999999999999915
[echo]
31: 10.65s, DELTA = 0.23000000000000043
[echo]
32: 10.99s, DELTA = 0.25
[echo]
33: 11.31s, DELTA = 0.25
[echo]
34: 11.62s, DELTA = 0.23000000000000043
[echo]
35: 11.96s, DELTA = 0.25
[echo]
36: 12.30s, DELTA = 0.2599999999999998
[echo]
37: 12.61s, DELTA = 0.23000000000000043
[echo]
38: 12.98s, DELTA = 0.2699999999999996
[echo]
39: 13.32s, DELTA = 0.2599999999999998
[echo]
40: 13.67s, DELTA = 0.2599999999999998
[echo]
41: 14.01s, DELTA = 0.25
[echo]
42: 14.35s, DELTA = 0.26000000000000156
[echo]
43: 14.69s, DELTA = 0.25
[echo]
44: 15.01s, DELTA = 0.25
[echo]
45: 15.38s, DELTA = 0.26000000000000156
[echo]
46: 15.73s, DELTA = 0.2699999999999996
[echo]
47: 16.06s, DELTA = 0.25
[echo]
48: 16.46s, DELTA = 0.28000000000000114
[echo]
49: 16.79s, DELTA = 0.28000000000000114
[echo]
50: 17.09s, DELTA = 0.21000000000000085
[echo]
51: 17.43s, DELTA = 0.259999999999998
[echo]
52: 17.78s, DELTA = 0.259999999999998
[echo]
53: 18.13s, DELTA = 0.2699999999999996
[echo]
54: 18.47s, DELTA = 0.26000000000000156
[echo]
55: 18.82s, DELTA = 0.26000000000000156
[echo]
56: 19.15s, DELTA = 0.26000000000000156
[echo]
57: 19.49s, DELTA = 0.25
[echo]
58: 19.83s, DELTA = 0.26000000000000156
[echo]
59: 20.16s, DELTA = 0.240000000000002
[echo]
60: 20.52s, DELTA = 0.2699999999999996
[echo]
61: 20.86s, DELTA = 0.2699999999999996
[echo]
62: 21.23s, DELTA = 0.259999999999998
[echo]
63: 21.59s, DELTA = 0.3000000000000007
[echo]
64: 21.97s, DELTA = 0.2699999999999996
[echo]
65: 22.32s, DELTA = 0.26000000000000156
[echo]
66: 22.73s, DELTA = 0.2699999999999996
[echo]
67: 23.05s, DELTA = 0.2699999999999996
[echo]
68: 23.40s, DELTA = 0.25
[echo]
69: 23.76s, DELTA = 0.28000000000000114
[echo]
70: 24.11s, DELTA = 0.2699999999999996
[echo]
71: 24.46s, DELTA = 0.259999999999998
[echo]
72: 24.80s, DELTA = 0.25
[echo]
73: 25.14s, DELTA = 0.2700000000000031
[echo]
74: 25.50s, DELTA = 0.25
[echo]
75: 25.85s, DELTA = 0.2699999999999996
[echo]
76: 26.18s, DELTA = 0.2699999999999996
[echo]
77: 26.53s, DELTA = 0.259999999999998
[echo]
78: 26.87s, DELTA = 0.26000000000000156
[echo]
79: 27.22s, DELTA = 0.26000000000000156
[echo]
80: 27.60s, DELTA = 0.28000000000000114
[echo]
81: 27.96s, DELTA = 0.3000000000000007
[echo]
82: 28.32s, DELTA = 0.28000000000000114
[echo]
83: 28.68s, DELTA = 0.2799999999999976
[echo]
84: 29.03s, DELTA = 0.259999999999998
[echo]
85: 29.41s, DELTA = 0.28000000000000114
[echo]
86: 29.85s, DELTA = 0.33000000000000185
[echo]
87: 30.25s, DELTA = 0.33000000000000185
[echo]
88: 30.63s, DELTA = 0.28999999999999915
[echo]
89: 30.99s, DELTA = 0.28000000000000114
[echo]
90: 31.36s, DELTA = 0.28000000000000114
[echo]
91: 31.72s, DELTA = 0.28999999999999915
[echo]
92: 32.09s, DELTA = 0.2699999999999996
[echo]
93: 32.49s, DELTA = 0.3200000000000003
[echo]
94: 32.85s, DELTA = 0.28999999999999915
[echo]
95: 33.22s, DELTA = 0.28000000000000114
[echo]
96: 33.52s, DELTA = 0.25
[echo]
97: 33.86s, DELTA = 0.240000000000002
[echo]
98: 34.22s, DELTA = 0.28000000000000114
[echo]
99: 34.58s, DELTA = 0.28000000000000114
[echo]
100: 34.95s, DELTA = 0.27999999999999403
[echo]
101: 35.33s, DELTA = 0.29999999999999716
[echo]
102: 35.76s, DELTA = 0.30000000000000426
[echo]
103: 36.17s, DELTA = 0.3200000000000003

I have tried running my macro on different Machines, Different browsers and the Same machine on different browsers. The result is different each time!

Sometimes the macro runs very fast and other times it’s very slow. There is no consistency in running!

I have monitored my system resource usage and the CPU usage is ~10% and Memory usage ~30%

I have tried clearing the browser history and resetting the browser as well. That too doesn’t help!

I doubt whether my target website performance affects the macro’s running time.
selecting id=ContentPlaceHolder1_DropDownList runs an Ajax on the website to fetch results. Then it shows the result on id=ContentPlaceHolder1_lblMsg. This result we are storing to available variable to check our condition

Does our script wait for a value in the id=ContentPlaceHolder1_lblMsg field? If yes, this may be degrading the performance as the website may not be fetching the result in 200 milliseconds!

Note: I have, store | true | !errorignore , store | 2 | !timeout_wait defined in the starting
I have defined 2 as timeout_wait as keeping 1 is breaking the loop occasionally!

Hello,

Excuse me. Are you perhaps using Microsoft Edge as your main browser?

From your original post, you said that around your macros run fine until the 15 to 20 minutes mark. My guess here is that the web page you are on is being throttled by your browser and you even mentioned low system resources when it slows down. It is unlikely that UI.Vision is being slowed down as it uses service workers.

You can test it out by interacting with the web page itself (like scrolling up/down or simply activating the tab or window it’s on) when it slows down. If the macro speeds up again, then it seems to confirm that your browser’s slowing it down. If not, then at least I tried, sorry, you can stop reading now.

Anyways, perhaps you could check out sleeping tabs and disable it or at least put your site’s domain in its exclusion list if you cannot disable it.

Another option is to web scrape everything in one go using javascript (within a single executeScript command) and output an array you can process using the forEach command). I don’t know how to do it or if it is even a feasible approach in your case; it’s just a trick I heard to minimize UIV’s and other Selenium-IDE based system overhead.

Thanks,