Not wait for page to fully load?
I have to test a web page that has javascripts on it that often take a long time to load. External JavaScripts outside of my control. However, the rest of the page is loaded, and I use Wait Until everywhere. Also the page is fully functional when these scripts have not finished.Sometimes these external script take a loooooooong time. So I set timeout= to 40 seconds or so.
Anyone have any ideas on how to get the page to continue past an Open Browser without waiting for such a long time?
This is quite typical problem with dynamic web applications. Usually it is bets to ask this type of question in the support channels: https://github.com/robotframework/SeleniumLibrary#support
But here are some pointers:
- Wait for a element which you know that is loaded last in the page by using the Wait Until Page Contains Element
- Sometimes there is loading indicator in the page, therefore wait for the loading indicator to appear and then wait to disappear.
- The 40s wait sounds really long one, perhaps you have some sort of performance problem in your web application. Or speed up the page load with some other means, this is usually best to discuss with your developers.
- My app runs on JQuery, so I poll JQuery.active to return zero two times in a row before I allow interactions with the page.
- Discuss with your development, how to better handle long timeouts. You and your development are the best persons who know how your application works and therefore best persons to answer your question.
But my keywords are full of waiting, polling and retry's, because that it how modern web applications are build and that is the only way to make test stable.
I am closing the issue because this is not a problem in the SeleniumLibrary but is more of support request and support is handled in other forums.
Yeah, I don't really want to pay for support. But thanks anyway.
The user group mailing list and slack are really good places for support and in there you get wider audience for your support request. I just want to limit the issue tracker for bugs and feature request and I do not have time response to all support request because I run this project on my free time (and I am not looking for money).
Cheers!
I don't think polling works if time is spent in by Open Browser. It having an option not to wait for the initial page to load would be a valid enhancement.
The timeout would be good thing to have, although I did understand that his page gets loaded with JavaScript (and Open Browser keyword gets successfully executed) and he has to use Wait... keywords to poll that the page is fully loaded. @illume could you explain the problem with more details? Perhaps showing a simple example and explaining where time is spent could clarify the problem.
@aalat, your solution of "Wait Until Page Contains Element" worked for me when automating salesforce web UI with JS in background. I had earlier used "Wait Until Element Is Visible" and "import library SeleniumLibrary timeout=30.0" but the test cases were failing because the page having that element XYZ was not loading. When I switched to "Wait Until Page Contains Element" the test succeeded consistently even with "import library SeleniumLibrary timeout=10.0". Thanks a lot.