Issue with HTMLButtonElement no size and location

Since everyone was wonderful in assisting me in solving the Stale Element issue, going to toss this one your way.

Intermittently I am receiving the following error when running my scripts, any ideas how to work around it? Is this another instance where I need to use JavaScript to work around a Groovy weakness?

Here’s the error:

javascript error: {"status":60,"value":"[object HTMLButtonElement] has no size and location"}
  (Session info: chrome=126.0.6478.127)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'BTT0247', ip: '192.168.0.108', os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_362'
Driver info: com.kms.katalon.selenium.driver.CChromeDriver
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 126.0.6478.127, chrome: {chromedriverVersion: 126.0.6478.126 (d36ace6122e..., userDataDir: C:\Users\KEVINJ~2\AppData\L...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:60376}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
Session ID: 15da994477db5647826a22a9317482a9

Thoughts?

1 Like

Hi there,

Thank you very much for your topic. Please note that it may take a little while before a member of our community or from Katalon team responds to you.

Thanks!

I just asked Google. It replied

This post suggests you:

  1. If you are using Headless browser, then just try headed browser to see if the same insident occurs.

  2. Try specifiying appropriate width and hight of browser window.

Please be informed, a Headless browser might have a different value of width x height of window as default (smaller than headed browser) — and you won’t recognize it as the window is invisible. If you do not explicity specify the width and height of window, then your test may fail only with headless browser.

Also, I would suggest you to try WebUI.scrollToElement() keyword just before WebUI.click() to give browser a chance to render the target element with some appropriate “size and location”.

Weird, it never posted my reply via email. Browser is running in standard mode (headed? Is that word a thing?) and maximized at open, so not quite sure why this error keeps occurring. Wondering if enhancedClick would be useful as well, what’s the worst is that it doesn’t tell me what object / script line it’s occurring on.

Anyone else had this issue?

Will also try the scrollToElement method as well if I can figure out where the darn thing is blowing up

UPDATE: it appears that the enhancedClick method may be the CAUSE of this issue. The first check fails, which causes enhancedClick to drop back to the Javascript method for clicking, which then works correctly and the object is selected.

The issue is that the first attempt that fails throws an error into the console, making it appear that the script has failed, when it actually hasn’t. Is there any way to turn off this error message coming from the enhancedClick attempt?

Example: in the below you can see where I do a check to validate that the desired object is present, then the first click attempt fails and throws an error, then the backup method kicks in and the click is successful, yet the logs report this as an errored run attempt:

Here’s the code, where one can see that if the click attempt itself had completely failed the run would have stopped, which it did not:

			//Validate desired time setting is found
			if (WebUI.verifyElementPresent(lookback_time_dropdown_value, 3, FailureHandling.OPTIONAL)) {

				//Select desired timeframe button
				WebUI.enhancedClick(lookback_time_dropdown_value, FailureHandling.STOP_ON_FAILURE)
				WebUI.delay(5)

				//Close lookback time section
				//KeywordUtil.logInfo("closing lookback section")
				//WebUI.enhancedClick(lookback_time_dropdown_button)
				button_found = true
}

Have you tried the same test with FireFox? Does it work with FireFox? If so, it implies that the root cause resides inside ChromeDriver and/or Chrome browser; not in your Groovy code.

Have you tried other versions of Katalon Studio? You should try it to see if the KS version matters or not.


In the following post, I described how you can find the source code of enhancedClick keyword :

If you read the source, you would understand that the enhancedClick performs 3 steps:

  1. try to click the HTML element by the ordinary WebElement.click() method. If failed, will fall down to the following step.
  2. try to scroll to the element and click the element by WebElement.click() with Wait. The Wait will expire after 30 seconds as default. If failed, will fall down to the following step.
  3. try to click the element by executing a javascript arguments[0].click()

It seems that the error “HTMLButtonElement no size and location” is raised during the step1 or step2. I have no idea why. There could be some unknown bugs in ChromeDriver.

Possibly you want to stop using “WebUI.click” and “WebUI.enhancedClick” at all. Instead, your Test Case script can execute a javascript script:

                    JavascriptExecutor executor = (JavascriptExecutor) webDriver;
                    executor.executeScript("arguments[0].click();", webElement);

@kevin.jackey

Does your test use WebUI.back() keyword somewhere?

I ask this question because recently I encountered a super-irrational error in my Katalon project that calls WebUI.back(). My script navigated to a URL, it tried “WebUI.verifyElementPresent” for a element and passed, clicked an <a href=".."> to navigate to anothother URL; then it called “WebUI.back” to go back to the previous page; it tried “WebUI.verifyElementPreset” for the same element, then FAILED! Wired!

What did I do for working around? I got rid of calling WebUI.back. I use WebUI.navigateTo(Strin url) again to go back to the previous page. Then the error went away.

I learned that there are some corner cases where “WebUI” keyword = wrapped call to the Selenium WebDriver API behaves wrongly. The final trick would be executing javascripts so that you go by-pass the W3C WebDriver protocol to manipulates remote browsers.

No use of WebUI.back anywhere, navigating forward and back always seems to make a mess of things, so I avoid it.

Since it seems to be failing at step 2 in the enhancedClick method I’ll try using the JS directly, I think it’s crazy that an error gets thrown out of an intended function design, causing the executor to get a script error message when the function is working perfectly fine

(post deleted by author)