Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit sitespeed when page doesn't load #3388

Closed
jajo-shubham opened this issue May 21, 2021 · 6 comments
Closed

Exit sitespeed when page doesn't load #3388

jajo-shubham opened this issue May 21, 2021 · 6 comments

Comments

@jajo-shubham
Copy link

When a URL is not found, Sitespeed keeps waiting for the page to load for 300 seconds. I want to customise this to exit out If there is no load event end for even 15 seconds or so. I read the documentation and saw the flag --pageCompleteWaitTime but that is not making any difference. On code inspection I also saw the flags timeouts.pageCompleteCheck and timeouts.pageLoad but they are not picked up and the defaults value are taken. Can you shed some light on how to achieve this and what do these different timeouts mean?

Example: sitespeed.io -b chrome https://gs-test-public.tricode.nl/ -n 1 --cpu --plugins.add analysisstorer --visualMetrics true --pageCompleteWaitTime 10000

@soulgalore
Copy link
Member

Hi @jajo-shubham it works like this:

First Selenium (webdriver) runs a JavaScript to go to the page and then you can use --browsertime.pageLoadStrategy to choose when sitespeed.io gets back control of the browser from the WebDriver. By default the page load strategy is "none" meaning we get control directly after the page started to navigate. Then the JavaScript configured by --browsertime.pageCompleteCheck is run to determine when the page is finished loading. By default that script waits for the on load event to happen, so that could be the problem for you. That JavaScript that tries to determine if the page is finished runs after X seconds the first time, that is configured using --browsertime.pageCompleteCheckStartWait. The default is to wait 5 seconds before the first check. During those seconds the browser needs to navigate (on a slow computer it can take time) and we also want to make sure we do not run that pageCompleteCheck too often because that can infer with metrics. After the first time the complete check has run you can choose how often it runs --browsertime.pageCompleteCheckPollTimeout. Default is 1,5 seconds.

For the pageCompleteCheck and loadTime I need to check the code, those are Selenium timeouts and I don't remember in my head how that work.

@jajo-shubham
Copy link
Author

Hey @soulgalore , Thanks for the quick reply as usual. As you said It is very much possible loadEventEnd is not being triggered. So I want to customise pageCompleteCheckTimeout Is it possible to pass this as a flag?

@jajo-shubham
Copy link
Author

Hello @soulgalore ... Any idea how to get the http response code and/or exit the process if it stuck ?

@soulgalore
Copy link
Member

Sorry I missed your first question: --browsertime.timeouts.pageCompleteCheck is the way to set that timeout.

get the http response code and/or exit the process if it stuck

In the pageCompleteCheck? There's no way today to get the response code in JavaScript. There's an issue for adding it to the Resource Timing API but its needed in the Navigation Timing API for this to work.

@jajo-shubham
Copy link
Author

jajo-shubham commented Jul 22, 2021

Thanks for reverting on this.. --browsertime.timeouts.pageCompleteCheck checks out .. I was using --timeouts.pageCompleteCheck (non-docker) and that wasn't being passed on in the options..

There's an issue for adding it to the Resource Timing API but its needed in the Navigation Timing API for this to work.

Do you have the link for the issue so I can check it out?

@soulgalore
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants