2
  • I am using SIDE 1.3.0 along with FF 6.0.2.
  • I stored a string using store text command which contains a "URL" by using the following command.

    storeText

which results as

MyCode = "<iframe src="http://myportal.com/mysales/Agent/index/4eb29642ce24e8.22143850/embedded" height="650" width="605" frameBorder="0"></iframe>"

I need to have only the URL part in another variable from the string above "http://myportal.com/mysales/Agent/index/4eb29642ce24e8.22334455/embedded" in order to proceed with the remaining test case. Thanks in advance.

2 Answers 2

1

Something like:

<tr>
    <td>storeEval</td>
    <td>'${MyCode}'.replace(/.*src="(.*?)".*/, $1)</td>
    <td>url</td>
</tr>

This will use JavaScript to set a variable called url to the value of the src attribute within your MyCode variable.

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

Comments

1

The first command below stores the href attribute of any element, you can modify it to your needs.

The third command uses javascript to get the pathname attribute of the DOM object.

Hope this answers your question.

If you open the IDE click on the source tab in the main window and copy and paste the code below between the tags, you'll be able to run the test on this page, or any other stack overflow page.

<tr>
    <td>storeAttribute</td>
    <td>css=.profile-link@href</td>
    <td>href</td>
</tr>
<tr>
    <td>echo</td>
    <td>${href}</td>
    <td></td>
</tr>
<tr>
    <td>storeEval</td>
    <td>this.browserbot.getUserWindow().document.getElementsByClassName('profile-link')[0].pathname</td>
    <td>pathname</td>
</tr>
<tr>
    <td>echo</td>
    <td>${pathname}</td>
    <td></td>
</tr>

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.