Prevent loading of stylesheets,images,subframes



Web applications accessed using the web browser connects to the server and downloads all the HTML components including images,cascading style sheets – css, frames and iframes as well via HTTP requests. All these content is downloaded from Server via internet via HTTP requests. This results in time for loading the webpages.
IS there any possibility in preventing loading of web application contents??
The answer is Yes, it is possible using Selenium WebDriver tool which helps in preventing loading of HTML components.
They are three ways of loading the Page

  • EAGER
  • NORMAL
  • NONE
Preventing Page Loading

Preventing Page Loading

Page Loading Strategy: eager
Setting the Page Loading Strategy as eager, prevents loading of CSS,images and Subframes.

Refer to Time in milliseconds:

PageLoadingStrategy in Selenium WebDriver

PageLoadingStrategy in Selenium WebDriver


Page Loading Strategy: normal
Setting the Page Loading Strategy as normal loads the CSS,images and Subframes as well. It loads all the components in the webpage.

Refer to Time in milliseconds:
PageLoadingStrategy in Selenium WebDriver

PageLoadingStrategy in Selenium WebDriver


Page Loading Strategy: none
Setting the Page Loading Strategy as none waits until the initial page is loaded.

Refer to Time in milliseconds:
PageLoadingStrategy in Selenium WebDriver

PageLoadingStrategy in Selenium WebDriver

Conclusion:
Preventing the web page from loading the html components is achieved using the Selenium WebDriver API.




Leave a Reply

Your email address will not be published. Required fields are marked *