1

I want to create a JavaScript date using text I stored from my site. This is what I tried:

<tr>
    <td>storeValue</td>
    <td>name=contract_additional_fields[agreement_created_date]</td>
    <td>seleniumContractDateValue</td>
</tr>
<tr>
    <td>echo</td>
    <td>javascript{Date.parse('${seleniumContractDateValue}')}</td>
    <td></td>
</tr>

I also tried using nothing or "" in the parse but neither one worked.

Can anyone help me figure out how I use a stored variable as a parameter of a JavaScript command?

1 Answer 1

2

1.you access variables with "storedVars['seleniumContractDateValue']" in JavaScript.

2.Selenium won't store a JavaScript date object, so you will need to parse it into a string as well.

<tr>
    <td>storeValue</td>
    <td>name=contract_additional_fields[agreement_created_date]</td>
    <td>seleniumContractDateValue</td>
</tr>
<tr>
    <td>store</td>
    <td>javascript{Date.parse(storedVars['seleniumContractDateValue'])}</td>
    <td>seleniumContractDateValue</td>
</tr>
<tr>
    <td>echo</td>
    <td>${seleniumContractDateValue}</td>
    <td></td>
</tr>
Sign up to request clarification or add additional context in comments.

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.