Refreshing browser question

What is good my dudes. Back like I never left with more questions.

My project contains a process in which I open up a new browser to a URL i get from a data table generated in a previous process. Upon reaching the site, I have a FindElement in place to look for a table I want to scrape. In summary, open browser -> find element (data table) -> scrape table. If the find element returns false, no table is scraped and I move on with the process.

Now until about 4 days ago, this was running smoothly, but now I’m faced with an issue. At times, the page will open up and just stay there loading for long periods of time. Usually it opens up and reads the table within a few seconds, but there have now been 3 occurrences where it takes a little longer.

What I’m trying to figure out is how to put in place a method that checks how long the page was open and refreshes it to try and load it faster. This is so the bot won’t time out in the middle of the most time consuming part of the entire process.

To try and simplify it, After the page opens the first time, if it takes too long to find the element (table), I want the bot to refresh the page and look for the element again until it finds it relatively quickly. The only real problem I’m trying to combat here is timing out because the page took too long to load.

I can try to elaborate a little more if necessary, but if anyone has any suggestions that would be awesome. Every question I’ve asked has helped me tackle an obstacle I’ve faced in this project and I couldn’t be more grateful of the input I’ve received, so thank you.

2 Likes

HI @Kriptiko

You can try something like this to get it to work. Use of retry scope is the best option here.
You can have the open browser activity first, then use the retry scope and within it a navigate to activity. For the condition, you can have an element exists to check whether the table is available or not.

Attached here is a sample which works…
ScreenLoadTimeoutHandling.xaml (7.6 KB)

1 Like

hi @Lahiru.Fernando,

I gave your suggestion a try. All I’m sure of is that the refresh action works as intended but I’m running into a new problem.

My project is designed to move forward when there both is and isn’t a table to scrape from the web page I load up. When the bot realizes there isn’t a table there, it moves on and will just enter the else side of an if statement I have further down. My issue now is the retry scope will refresh the number of times I have specified even though it is supposed to move on whenever it finds or doesn’t find a table.

This is the part of the workflow I’ve been trying to apply this too. I’m now trying to figure out how I could break out of the retry scope whenever the table has been found/not found. I don’t want the retry to happen when it can’t find the table, I only want to retry to happen when the page is taking a while to load <- that’s the phrase I was looking for.

Any help appreciated, thanks again

@Kriptiko
You could try a different check for if the page is loaded or not, rather than the table. Look for some other element, at the end of the page, or something, that will always be there whether the table is there or not and check for its existence. If its not there, refresh - other wise, page loaded, now check for table and continue as you currently do.

1 Like

I figured it out, I did some searching and found to just look for the refresh page icon, but for this instance, your reply was the type of answer I was looking for @sagacity . Thank you both for your insight!

1 Like

Hey @Kriptiko

Sorry for the late reply… As @sagacity mentioned, you can apply his solution to the snippet I shared which will get it done for you :slight_smile:

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