IE - test says it's clicking the button, but it's not really

I’m running a test that is successful both in Chrome and Firefox (browser and headless) but when I get to IE, the test will find the button and pass the step that says click, but it doesn’t actually click and advance the screen.

WebUI.openBrowser(GlobalVariable.url)
WebUI.delay(5)
WebUI.click(findTestObject('Basic signon/ExistingSign In')) --this is the spot that doesn't click in IE

How do I make it click in IE without drastically changing my tests for other browsers?

(I have to use IE bc we have clients that use IE)

Any help is appreciated!!

Hi Amanda

While I may not have seen this exact same problem myself, I have witnessed very similar oddities between browsers, not least with IE.

The solution (which you may hate) is to use JavaScript to generate the click. I can guarantee [1] that JavaScript hosted on that page would be able to click that element without issue. When you inject JavaScript from your test case into a page, that is exactly what you get – JavaScript now hosted on the page.

If you need help writing a JavaScript Click API in Katalon, read the last message here: http://forum.katalon.com/discussion/2008/execute-javascript#latest

Hope this helps.

[1] As long as there is no underlying browser quirk (i.e. bug) why IE is behaving badly.

well, thank you. I tried this:

WebElement element = WebUiCommonHelper.findWebElement(findTestObject('Basic signon/ExistingSign In'),30)WebUI.executeJavaScript("arguments[0].click", Arrays.asList(element))

still didn’t click on the element. I’m am 100% okay with “You did it wrong”

NOTE: I have added the desired capabilities to ignore the Protected mode and ensure clean session and introduce flakiness by ignoring security domains

Once again that thread bites me (us). If you read my posts there (apart form my last) you’ll note how I’ve begged that Katalon Team close it or at least thin it out.

You’ve fallen foul of the one typo I tried to get someone to fix:

Russ Thomas said:

arguments[0].click()

Edit: Which is a misleading error message because the reference to the click method is typeof === “function”.

Regardless, you still need to add open and close parentheses to effect the call.

So in your case, Amanda:

WebElement element = WebUiCommonHelper.findWebElement(findTestObject('Basic signon/ExistingSign In'),30)WebUI.executeJavaScript("arguments[0].click()", Arrays.asList(element))

You know what? I even know better! I took note of what you said and meant to fix it.

And it works.

Thank you

and btw Katalon Moderators, fix the arguments WebUI.executeJavaScript(“arguments[0].click”, Arrays.asList(element))
on this page: https://docs.katalon.com/display/KD/[WebUI]+Execute+JavaScript

follow up question: is there a way to make a keyword so that the click is reusable and not just tied to that one specific element?

Amanda Perkins said:

follow up question: is there a way to make a keyword so that the click is reusable and not just tied to that one specific element?

Isn’t that the answer at the end of that thread? If not, I’m not sure what you’re asking…

I got it now. It’s been a long day. So if I take the .click() and make that the keyword, I can reuse that in place of the webUI.click()

Just FYI…

99.99% of my element interactions (clicks, set text, get text, blah blah blah) are JavaScript.

So yes. Wrap it up as a Keyword and never look back B)

1 Like

I am starting to come to the same conclusion that this is the way forward. I’ve had to use this solution a lot recently…