Željko Filipin's Blog on Software and Testing

Test like you do not need the money.

Watir Has A New Method: after?

with 2 comments

Imagine that you have two links. Both links are the same.

<a>text</a>

The only thing that makes them different is that the second one is located after an image.

<a>text</a>
<img src="image.png" />
<a>text</a>

Of course, you just have to click the second link. You have already tried this.

browser.link(:text, "text").click

But, it always clicks the first link. There is a way.

browser.link(:after?, browser.image(:src, /image/)).click

This is so cool.

(You will need Watir 1.5. Bret Pettichord posted that at wtr-general.)

Written by Željko Filipin

May 25th, 2007 at 2:35 pm

Posted in Watir

Tagged with

2 Responses to 'Watir Has A New Method: after?'

Subscribe to comments with RSS or TrackBack to 'Watir Has A New Method: after?'.

  1. Zjelko,
    Yes, when I saw that, I too was amazed. Very cool.

    Jason

    29 May 07 at 6:34 am

  2. Yes, I am waiting for a long time for this one. Good Job. Please keep touch with me. I am always available in this mail id raveendran@railsfactory.org

    Raveendran

    29 May 07 at 11:33 am

Leave a Reply