Help with Javascript loading

Hi all.

I´ve got a really really enjoying problem. A process is using a internal map (so I can´t link to the website…), that will load filters etc using Javascript.

The problem is that there is absolutely no way to se if the map is loading or not. There is no possibility to get any selector that indicates that the website is loading.

I have tried to use Inject JS activity to no avail. I have tried to get a working script with ChatGPT for countless hours (well at least 10+).

The problem arises when the Internet may be a bit slow and the filter don´t have had enough time to load before the process continues.

Can someone please help me?

WaitForReady.COMPLETE do Not work.

If you can’t get any element or attribute that shows if filter load or not, you can use Retry Scope activity and put the activities you are using for select the filter into it.

In Retry Scope activity you can add x times and retry interval

put your inject js activity inside a retry scope @Jona2

this way, if its not loaded yet, the inject JS activity will fail and it will retry… until it is finished loading

the default retry is only 3 times, so you can change it like this
for example in the below image, i retry 60 times, 1 second between each retry

@Jona2

Welcome to the community

Retry scope is one

Another is using click or type into modern activities with verification option where it verifies if the required action is completed else retries the same action again

Cheers

I do not have a JS script that works unfortunately.

How would that help me do you mean? Im sorry but i do not really follow. How can i verify the action is completed when i can get any attribute or selectors for the loaded fiter ex.?

That is already done. The problem is the filter can take a long time to load even if the activities used for selecting the filter is working properly.

@Jona2

In the filter ypu would be selectingb a value right…add that to the verify execution so that it will check if the filter has been executed or not…if not executed then it would retry to set the filter again

Cheers

Hi
Can you check if after you applying the filter, the url changes ? Maybe using F12 (devtools) help you to investigate if there’s something that you can use it

Hi @Jona2
You can try with following methods

  1. You can try with Image Exists / On Image Appear
  2. For Inject JS Activity you can try this
    function checkState() {
    // Assuming ‘mapLoaded’ is a JavaScript variable that indicates the loaded state
    return (typeof mapLoaded !== ‘undefined’ && mapLoaded === true);
    }
    return checkState();

Hope this helps