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.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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.