Unable to click on image in IE11 (document mode 7)

Hi there,

The below code works in Chrome but not in IE 11 (Compatibility mode):

Basically. Once I click on an image icon (magnifying lens image|46x43 ) then an input box displays and i enter a value 1234

WebUI.click(findTestObject(‘Object Repository/Page_X/img_Y’))
WebUI.setText(findTestObject(‘Object Repository/Page_X/input_Z’),‘1234’)

The error message I get in IE :

Reason:com.kms.katalon.core.exception.StepFailedException: Unable to set text ‘1234’ of object ‘Object Repository/Page_X/input_Z’ (Root cause: org.openqa.selenium.InvalidElementStateException: Element must not be hidden, disabled or read-only

In IE, I am unable to click the image and get the input box…( the input box is hidden and is only displayed when the image is clicked)

Any recommendations greatly appreciated… works in Chrome but not In IE

Thank you so much,
Tina

Each browser may have different response times in creating/showing dynamic elements. Try a delay as above.

1 Like

I tried adding delay many times and it’s still not working. tried adding WebUI.delay(20) before and after clicking the img_Y line but img_Y is not getting clicked at all.

Thank you,
Tina

Show me the HTML surrounding the image.

I added X, Y, Z in my initial post as the id’s were long…

That’s fine - I guessed they were placeholders for the real thing.

Post a screen shot of the HTML (right-click on the image, choose “inspect” and show me the relevant HTML)

Thanks a lot…

String js = "document.querySelector('#ctl00_ContentPlaceHolder1_ctlHierCust_imgCustLookup').click()"
WebUI.executeJavaScript(js, null)
WebUI.waitForElementVisible(findTestObject(‘...input_Z’, 10)
WebUI.setText(findTestObject(‘...input_Z’),‘1234’)

Try that.

I get Unable to execute Javascript error…

Thanks so much for all your help

That usually means a typo in the JavaScript. I checked it and don’t see any problem.

Let’s try this. In your browser, go to the problem page and open the devtools again. Go to the console and paste this:

document.querySelector('#ctl00_ContentPlaceHolder1_ctlHierCust_imgCustLookup')

Send me a screen shot of the output.

Then paste this:

document.querySelector('#ctl00_ContentPlaceHolder1_ctlHierCust_imgCustLookup').click()

That should cause a click to happen on your img element. Again, send me the output.

I get below:

Okay, Tina, this is crazy.

Which browser? Version?

Operating System? Version?

Can you send an image of the whole browser with the devtools open on the console?

Can you send an image of the whole browser with the devtools open on the inspector with the image element highlighted?

Oh wait… if document mode 7 means “emulate IE7” then that’s your problem. You’re not going to get anything to work with that.

This is in IE 11 ( compatibility mode) running on Windows 10

A quick ddg search says it’s IE7 mode. 99.99% of your tests will fail to work properly since IE7 is not web standards compliant.

oh ok ! Thx you so much! I will check if i can move it a bit higher and will retry. Thanks so much. Totally appreciate all your help and patience.

1 Like

“a bit higher”? Make it IE11 raw.

Unfortunately, the application is supported on IE Compatability mode. Thx a ton for your help though.

1 Like

You should probably remind your bosses, IE7 is not supported by Microsoft and is a security risk for users. Trying to test it is futile.

I know, not easy but it’s true nevertheless.

I can see from the code they’re using ASP.NET to develop the application (same as me) and I’ve had similar conversations about crappy browser support many times. You would do well to voice your thoughts clearly using sound arguments that their customers should upgrade in a more timely manner. Soon, Edge will become a “thin-skin” over Chromium with IE emulation built in. But even then, I’m pretty sure IE7 will not be one of the emulation choices.

I agree totally!