robotframework / robotframework/SeleniumLibrary

Add "Wait for DOM inactivity" keyword which waits until page is fully loaded/rendered

Open
#1,764 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

Prerequisites

For issues

Steps to reproduce the issue

N/A

Error messages and additional information

N/A

Expected behavior and actual behavior

N/A

Environment

N/A

Feature Request Background

In an effort to improve page performance, modern web apps load initial content, then load the rest of the data on the page via XHR requests. The page continues to mutate until all additional data is loaded. This is a major problem for old frameworks like Selenium, which simply wait until the initial page loads but do not wait until the content on the page fully loads.

Examples of this loading style can be found on sites like:
airbnb.com
amazon.com
buzzfeed.com
yahoo.com

A workaround we've found extremely useful at my company is to leverage the relatively new Mutation Observer api (docs here).

This mutation observer can be configured to fire a callback every time a node on the DOM is added or mutated. This can be used to detect when the page finally calms down and is ready for the automated test to continue.

Feature Request

My feature request, which I will implement, is to leverage this mutation observer in a new keyword "Wait for DOM Inactivity", which the user can call to wait on the XHR requests on dynamic pages (like those listed above) to finish.

Some key scenarios where this can be used are:

  • pretty much any automated test which tests against a single page app
  • whenever a button click opens & loads a modal
  • on highly performant, dynamic pages which heavily leverage XHR requests (like those listed above)

Let me know if this interests you, I would be more than happy to implement this. I have used SeleniumLibrary extensively and love the library, and would love to contribute to it in any way.

Thank you for reading my request!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names SeleniumLibrary's new Wait for DOM Inactivity keyword and the browser-side Mutation Observer API, but no repository files or tests. Start by locating the existing wait-keyword entry points and their tests; done means the keyword is available for dynamic pages and its behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.