'Not progressing from Nuxt loading screen

We are using Nuxt.

The ssr and target of the nuxt.config.js are set as follows

export default {
  ssr: false,
  target: 'static',
}

Our site is working almost exactly as expected. However, when we check our site after checking other tabs in our browser, we are sometimes unable to move on from the loading screen.

What is the cause of this? We have logs in the middleware and on each page and component to investigate, but the logs do not show up on the console and we are unable to determine the cause.

What should we suspect and what should we investigate?

The reproduction rate is not 100%. It may have occurred after a day or so.

enter image description here



Solution 1:[1]

It seems like this may be a classic "race condition". I think what's happening here is you're getting the html code from selenium before it's done executing the js code and finishing rendering the whole page - thus the page loading fully is racing against the code reaching the driver.page_source line. Try importing time and adding a time.sleep(4) to sleep for 4 seconds right after calling the driver.get(url).

If this works for you (and it might not and I could be totally wrong since I don't know what page your scraping so I couldn't verify my answer for myself), you may want to look into using the WebDriverWait function. It allows you to wait until an element on the page is found so that you know the page is fully loaded by the time you start looking for information on it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Themis