2

I'm trying to replace " characters within text stored within a Selenium IDE test.

As an example I'm doing

<tr>
<td>storeText</td>
<td>id=request-header</td>
<td>variable1</td>
</tr>
<tr>
<td>echo</td>
<td>javascript{'hi'.replace('i','a')}</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>javascript{$variable1.replace('G','a')}</td>
<td></td>
</tr>

The first echo outputs 'ha' but the second results in an error.

Thanks

1 Answer 1

7

In javascript execution context you have to use the storedVars array to access stored variables:

<tr>
  <td>echo</td>
  <td>javascript{storedVars.variable1.replace('G','a')}</td>
  <td></td>
</tr>
0

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.