WebUI.executeJavaScript() alert in Safari

@Patrick_Clough, I’m moving this to the Bugs category. In the meantime, try updating your safari webdriver.

@devalex88 There is something strange going on here. Please read the foregoing, then please consider my further points here…

The key error lines from Patrick’s dump seem to be:

And …

The first line seems to be the “new normal” if an alert is present and acceptAlert() has issues - but why? The latter message seems weird to me. I don’t have access to Safari so I can’t investigate further.

When I run this code (note WITHOUT an acceptAlert()

    WebUI.executeJavaScript('alert("Hello World")', null)

I see the alert then get these two lines:

Unable to execute JavaScript. (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to execute JavaScript. ...

And then as you would expect…

Caused by: org.openqa.selenium.UnhandledAlertException: Dismissed user prompt dialog: Hello World: 

Can you explain why Katalon/Webdriver is responding with “Unable to execute JavaScript”? There is no Javascript beyond the call to alert() so what JavaScript is it unable to execute? :exploding_head:

I am now of the opinion that my assumptions about execution of JavaScript while the browser is “paused” on an alert maybe ill-founded. I’m not completely certain but I thought I had done that in the past and recently found it was not working. That is what caused me to write this tip:

When I wrote the tip I thought it made some sense that the browser couldn’t run more JavaScript… but that’s the same message here with one line of JS it certainly has run. :exploding_head:

If you can find out why this is happening and solve the safari issue at the same time I’ll make sure we sing your praises from rooftops all round the world :wink: