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
sffer
July 26, 2018, 9:25pm
6
hello @Ananth raghav
i have the same problem, and i donât know how i can resolve it
Prabhu
October 22, 2018, 7:01am
7
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
Prabhu
October 24, 2018, 8:07am
8
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