[Ask] Empty Textarea detected as not empty

So the website is using CkEditor as Textarea

I tried to approve it on a normal browser (Chrome), but the empty content was detected, and the alert popped out as failed. But when I tried to use Katalon Spy and Record feature, I submitted an empty textarea like before, and it succeeded. When I check the database, this is the submitted data


three first is an empty textarea that has been submitted, while the last data is the normal browser data (I need to fill the textarea first because it will trigger the empty field alert like it expected to)

Is there any setting I should do on the Katalon so I can trigger the empty field alert?

2 Likes

Hi em, could you take a look at this topic? Thanks em

Hi,

Welcome to our community. Thank you for letting us know your concern. Can you please share your code when testing on a normal browser?

Not sure why you would want to.

If the app and editor is meant to show an alert when the content is empty, then you should create those conditions like a user would.

A few things you need to know

CKEditor is NOT a <textarea>. It is a <div> element with contenteditable="true".

Getting the content

Unlike a <textarea> where you can retrieve its content using its .value property, you can retrieve the content of a <div> element (including all the HTML) by using JavaScript to access the .innerHTML property of the element.

String js = "return document.querySelector('#my-ckeditor`).innerHTML;"
String content = WebUI.executeJavaScript(js, null)
println content
1 Like