Unable to remove attribute "readonly" in datepicker

Good Day,

I’m new to automation and don’t have much experience and I only rely on google and youtube

Currently I’m working on a datepicker that user cannot manually input as the attribute is readonly
And I just want to remove the attribute “readonly” but it seems not working after I run my script



WebUI.removeObjectProperty(findTestObject('ordersPage/dtpCreationDateF'), 'readonly')

WebUI.setText(findTestObject('ordersPage/dtpCreationDateF'), '1/31/2022')

Object and HTML

Object Xpath
//div[@class='v-text-field__slot']/label[contains(text(),'Creation Date From')] /following-sibling:: input[@readonly='readonly']

After Execution
It say’s for
WebUI.removeObjectProperty(findTestObject('ordersPage/dtpCreationDateF'), 'readonly')

01-31-2022 12:11:32 PM removeObjectProperty(findTestObject(“ordersPage/dtpCreationDateF”), “readonly”)

Elapsed time: 0.062s

Remove property of object successfully

and after I set text it fails
WebUI.setText(findTestObject('ordersPage/dtpCreationDateF'), '1/31/2022')

And when I checked again the object attribute the “readonly” still there.

Is there any way I can remove the attribute readonly so I can input manually a date?

Example will be appreciated if have


Principally the UI test scripts should behave as if it were a human user. The UI test script should do only what a human user can do. Your script should not try removing the “readonly” attribute forcibly.

When you manually open the page in browser, do you have any chance to input data into that <input> field manually?

I guess, somehow, you can.

Then how do you do it? I guess, you need to do something before inputting the “Creation Date From”. When you do it, the “Create Date From” field might be changed to “writable” by the JavaScript on the page.

Hi Kazurayam,

Currently I’m able to manually input a date if I remove the “readonly” when inspecting the element and after that I can manually type any values there.

Yep and I agree that script should behave on how user can interact in the Front End but I just want to know this kind of script on how it is perform.

Write a JavaScript that modifies the DOM of the page, and your test script sends the script to browser using

WebUI.executeJavaScript() keyword.

You can do almost anything on the page DOM with javascript.

Thanks Kazurayam!

I will check on this