Unable to set text 'some text' of object 'MyObject' : UnhandledAlertException: unexpected alert open


Since 2 days I try to set an input which contains a date. To do that I use

WebUI.setText(findTestObject('ObjectRepository/Path', 'some text')

(the type of the input is text)

However this error occurre

Unable to set text ‘some text’ of object ‘Object Repository/Path’ (Root cause: org.openqa.selenium.UnhandledAlertException: unexpected alert open: {Alert text : alert content.}

It is normal than an alert appear when the input is fill. But I don’t know how to fix this error. Moreover, I don’t understand why setText() failed because of the alert…

Thank’s for your help!

Could you please take a screenshot of the target page with “unexpected alert open”, and attach it here?

I found a solution !

I use javascript to set the value of my input instead of setText().

WebUI.executeJavaScript('$("#' + id +'").val("' + value + '")', [])

Thank’s !

Hey Nico!
I try to use your script, in the id field you copy the id of the field? Is not working for me!