Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I'm trying to get a list of all the links that follow a certain rule ( their href is Downloads.aspx?<somestring> )

*Note: I'm using Selenium IDE, the Firefox plugin for this.

In order to get the links, I use this code :

<tr>
    <td>open</td>
    <td>/DownloadsHome.aspx</td>
    <td></td>
</tr>
<tr>
    <td>storeXpathCount</td>
    <td>xpath=//a[contains(@href,'Download.aspx')]</td>
    <td>links</td>
</tr>
<tr>
    <td>echo</td>
    <td>links : ${links}</td>
    <td></td>
</tr>
<tr>
    <td>storeAttribute</td>
    <td>//a[contains(@href,'Download.aspx')][1]@href</td>
    <td>tmpHref</td>
</tr>
<tr>
    <td>echo</td>
    <td>${tmpHref}</td>
    <td></td>
</tr>
<tr>
    <td>storeAttribute</td>
    <td>//a[contains(@href,'Download.aspx')][3]@href</td>
    <td>tmpHref2</td>
</tr>
<tr>
    <td>echo</td>
    <td>${tmpHref2}</td>
    <td></td>
</tr>

Now, the result for ${links} is 301 and I get the correct result for ${tmpHref} but for anything other than //a[contains(@href,'Download.aspx')][1]@href I get [error] Element //a[contains(@href,'Download.aspx')][<number>] not found.

Any idea what I'm doing wrong ?

share|improve this question
    
2 questions: 1. Is it supposed to be Download.aspx or Downloads.aspx? 2. Have you tried [first()], [last()], and [position()=3]? –  rishimaharaj Mar 18 at 3:12
add comment

1 Answer 1

This is a pretty old answer. I would use Selenium Builder instead. The Selenium project is in the process of replacing Selenium IDE with Selenium Builder.

Most likely, after recording your script, you might want to make minor edits to the script by hand to get it working the way you want it to.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.