IE issue: impossible to start inrpivate browsing and impossible to clear local storage


After checking a lot of posts, it looks like it is impossible to open internet explorer in private mode with desired capabilities, and I looked everywhere for a way to delete local storage from the script itself.
Nothing works.

I use Katalon 6.2.1.

I have already tried
In the desired capabilities of IE:
FORCE_CREATE_PROCESS, set it to true
InternetExplorerDriver.IE_SWITCHES, set it to “-private”

In the script itself, add the line:

WebUI.executeJavaScript("localStorage.clear() ", null)

Nothing seems to work.

I am trying to keep the script code cross-browser.

Any help is welcome.

Perhaps somebody has an explanation about why

WebUI.executeJavaScript(“alert(‘This is an alert’)”, null)

is working perfectly, but

WebUI.executeJavaScript("localStorage.clear() ", null),

is not working at all, and it doesn’t throw any exception?

Thanks for your support.


I got the answer already. Perhaps is useful for somebody.

The problem: IE doesn’t start in private session, so I won’t pass by the login page, and that is the foreseen behavior in my script. If I run the script in FF or Chrome, it works, no problem, because

When I call WebUI.openBrowser(’’), I don’t have available the localStorage yet via javascript. I have to call it after the instruction WebUI.navigateToUrl(’’).

Then, because the website is already called, I have to do a refresh so the login page is displayed.

WebUI.executeJavaScript(“localStorage.clear()”, null)

The desired capabilities, in this case don’t work.