How to follow a link that does not have any text
Sometimes you will have a link that has no text, ID or class name. You might even have several of these in a list, something like:
<div id="products">
<a href="/product1.html"><img src="image1.jpg" /></a>
<a href="/product2.html"><img src="image2.jpg" /></a>
<a href="/product3.html"><img src="image3.jpg" /></a>
</div>
Obviously here there is no ID, class name or text that you can specify to the script editor. To handle this, StillAlive lets you use CSS selectors to say which link you would like to follow:
Say you wanted to follow the second link on the page within the
div#products group, you could write the following
script:
When I follow "div#links a:eq(2)"
Then I should be on "/page2.html"
Note with the :eq() CSS pseudo operator, lists
start at 1, not 0 as happens in most programming languages.