Invalid element state: Element must be user-editable in order to clear it

In Katalon Studio, I am not able to setText to The expiry Date input field above. I am getting the error invalid element state: Element must be user-editable in order to clear it.

Has anybody come across such a input field. Any help related to this is greatly appreciated.

Screen Shot 2018-04-27 at 12.07.53 PM.png

Hard to tell. Can you share some relevant HTML?

Ananth raghav said:

In Katalon Studio, I am not able to setText to The expiry Date input field above. I am getting the error invalid element state: Element must be user-editable in order to clear it.

Has anybody come across such a input field. Any help related to this is greatly appreciated.

This input field is a read-only field, therefore you can’t set text on it. In this case, my suggested solution is set value to it directly using Javascript

Below is my sample code , please replace the test object and its value:

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import org.openqa.selenium.WebElement
import com.kms.katalon.core.webui.common.WebUiCommonHelper
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebElement element = WebUiCommonHelper.findWebElement(findTestObject('your/object'),30)
WebUI.executeJavaScript("arguments[0].value='Your Value';", Arrays.asList(element))
4 Likes

Thanks a lot @Vinh Nguyen
The sample code shared by you did the job. Nice stuff

hello @Ananth raghav
i have the same problem, and i don’t know how i can resolve it

Vinh Nguyen said:

Below is my sample code , please replace the test object and its value:

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import org.openqa.selenium.WebElement
import com.kms.katalon.core.webui.common.WebUiCommonHelper
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebElement element = WebUiCommonHelper.findWebElement(findTestObject(‘your/object’),30)
WebUI.executeJavaScript(“arguments[0].value=‘Your Value’;”, Arrays.asList(element))


  

Why you are using arguments[0].value here?

1 Like

Vinh Nguyen said:

Below is my sample code , please replace the test object and its value:

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import org.openqa.selenium.WebElement
import com.kms.katalon.core.webui.common.WebUiCommonHelper
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebElement element = WebUiCommonHelper.findWebElement(findTestObject(‘your/object’),30)
WebUI.executeJavaScript(“arguments[0].value=‘Your Value’;”, Arrays.asList(element))


  

Below is my code

WebElement cardnumber = WebUiCommonHelper.findWebElement(findTestObject(‘Payment and billing settings/Card details card number input box’),30)

WebUI.executeJavaScript(“arguments[0].value=‘4242 4242 4242 4242’”,Arrays.asList(cardnumber))

While executing in input field text are not displayed ,but in console it shown as set text executed successfully.

Any solution for this?

Console output

Screenshot_1.jpg

Im also facing the same issue.
@Zarashima
Please help us out