Pyppeteer query page contents after timeout? - google-chrome

After navigating to a page, I would like to wait for either:
The page to load, OR
A timeout (20 seconds)
However, after catching a TimeoutError, it reports that the original page has crashed and I cannot retrieve the contents.
Is it possible to hit a timeout but then query the page contents?

Related

Apify pupeteer, don't wait for complete load of page

I'm having a problem with page which is taking too long to load (some scripts).
If i set handlePageTimeoutSecs or navigationTimeoutSecs parametres the request fails and goes back to the queue, is it possible to set to stop loading and parse data regardless of the complete of the page? Thank you for your help

How to prevent browser from loading js from memory cache by range?

I opened my website in Chrome last night, then closed that tab, but didn't close browser. Today I failed to open my site in a new tab because jQuery(not use CDN) hits a syntax error: unexpected end of input.
My site always hits this error no matter how many times I refresh. But the error didn't happen again after hard refresh.
This problem happens many times in recent months.
I checked Chrome devtool, it says my jquery.min.js is loaded from memory cache. And it is not a whole file, only contains part of jquery library. That's why I got syntax error.
I did some research from google:
The lifetime of memory cache is attach to the lifetime of render process, which roughly corresponds to a tab.
So if I create a new tab to visit my site, stands to reason, jQuery should not be loaded from memory cache.
I expect browser do not load my files from memory again if I visit site in new tab.
Is there anything I can do to locate the problem source and fix it?
EDIT (2019-05-13):
Today hit this error again, but fortunately, I found new point seems helpful to this problem.
This is that request:
See status code is 206 Partial Content (from memory cache).
And I have no idea why my request header contains 'Range' field.
You can't detect newtab in browser and load your jquery.min.js,But you can avoid loading from cache by adding timestamp into suffix of your lib like follows.
http://yoursite.com/lib/js/jquery.min.js?1557301884
You can achieve this in two ways
Case:1 If you are using server side page rendering means(PHP,JSP) just print the timestamp
Case:2 If Client side means some javascript stuff you have to do

Node.js/Express 4 - How to update a page to show progress in workflow

i built a small page to track a workflow with multiple steps. The page contains a form with submit button to start the flow. Each step sends back a status to the page. The page html is rerendered with res.render() then and sent to the server with res.send(html).
My problem now is, that when i use res.send(), the next status update gives a failure, because the response process is finished before.
Using res.write() instead crashes the page for whatever reason. I looks like the page is appended a second time (from a buffer??), instead of overwriting it.
Any ideas how to solve that??
Moe

Resource shows Pending and From Cache in Google Chrome Network Tab

I have two resource on my website (png files) that are showing as Pending when I load the page. However, the files did load properly. I guess this occurs because the images were loaded from the browser cache as displayed in the Size column.
Is it expected that a resource loaded from cache will show Pending in the Time column? If this is the case, why is this not the same for the deployment.js file? It shows it was loaded from cache but we can see it took 1ms to load. In this case, all three resources (js and pngs) have loaded successfully, hence the confusion. Thanks.
I notice that the resources that have pending next to them are from external domains. Could it be a cross domain 'issue'?
Anything retrieved from cache should still have a 'time' assigned to it, so it's not directly related to the fact it's from cache.

How to delay MainPage, so it starts after data is loaded?

I have an application that stores data in isolated storage. I have a function to read the data (called in Apps.xaml.cs):
await ReadData();
However, before the data read, OnNavigatedTo is called in MainPage. At that point the buffer holding the data is still null.
How can I prevent MainPage.OnNavigateTo() from being as long as ReadData is not complete?
I tried syncing Apps & MainPage by setting a semaphore in Apps, and WaitOne() in the MainPage constructor. This hang the app on the WaitOne.
Any idea how this timing problem can be solved?
You can't delay the loading of the main page - as if the loading cycle is not executed within a timely fashion the app will be closed by the OS.
The best way around this is to create an interim splash page, which will handle the downloading of data whilst showing UI to the user. Once the data has downloaded you can then redirect to your main application page.