Unable to access UI elements while the browser is loading the page

Unable to access the UI elements from the web page while the browser is loading the page.

We have added a loading image to display on every page load. We have to check whether the loading image is displayed or not during the automation testing. But we are not able to access it while the browser is loading. Once the browser gets loaded, the loading image disappeared. Please suggest.

Thanks in advance.

1 Like

You do not want to wait for the page to load? Then you should not rely on Katalon’s WebUI.openBrowser(str) and WebUI.navigateToUrl(str) keywords as these will always wait for the page to load. You can not stop its waiting.

Use the Selenium WebDriver native API. With it you can control total behavior of your tests. See

This document explains how to let your tests to wait for the page loading. Vice versa, I think, you should be able to avoid waiting for the page loading intentionally.

Disclaimer: I have never tried such scenario.

1 Like

@Divya_T -Please refer doc [WebUI] Wait For Element Visible | Katalon Docs

1 Like

@Divya_T I think the replies so far are not understanding your issue.

@kazurayam @atul.rai What the OP is trying to achieve is, check if a particular splashscreen is displayed while the page is loading.

Note, not AFTER the page has finished loading (which would make no sense because the splashscreen will have been removed) WHILE THE PAGE IS LOADING.

Therefore, help and suggestions involving WAIT methods are a complete waste of time – @Divya_T absolutely does not need to wait ← that’s the point.

@Divya_T Use a JavaScript test step to check the dom for the element that is hosting the image. Something like:

String js = 'return document.querySelectorAll("div.splash img").length'
int length = WebUI.executeJavaScript(js, null)

You will of course need to wrap that code in loop and continue checking to see if the image appears. It’s up to you if you then proceed to another loop, checking see if the splash disappears.

Here is the same code (different selector) making sure your avatar is displayed on this forum page thread:

If you want to be precise about the content of the image then you will need to use snapshots and visual testing of some description.

2 Likes