1

I'm using Selenium IDE to fill out a form. It's not my website, so I cannot change the code. I've managed to do most of the things, the only input I'm struggling to put the data on is this one, which uses a datepicker/calendar instead of the a "traditional" input:

enter image description here

<input class="rich-calendar-input " id="dtEmissaoInputDate" maxlength="10" name="dtEmissaoInputDate" onkeypress="IsNumber(this,event);mascaraData(this,event);" size="15" style="vertical-align: middle; " type="text" value="09/10/2019" readonly="readonly">

Since I'm new to Selenium, I'd like to know how to change the value of that input using the data I have on an array. I've already searched older questions to see what I could find, but most of the answers use older syntax.

Thanks in advance for the answers.

2 Answers 2

2

You can use Javascript to accomplish this. You can call executeScript to modify the value attribute of your desired element.

executeScript("document.getElementById('dtEmissaoInputDate').setAttribute('value', 'yourTextHere')");

You can also pass the element in directly:

executeScript("arguments[0].setAttribute('value', 'yourTextHere')", inputElement);

Hope this helps a bit.

Sign up to request clarification or add additional context in comments.

Comments

0

Found the solution. Based on @Christine's answer, I was to solve the issue using Javascript and run script command:

"command": "runScript", "target": "document.getElementById('dtEmissaoInputDate').value='01/01/2018'",

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.