I'm using watir-webdriver have several lines of the same code shown below:
...
<p class="schedule-text">
by
<a href="http://www.somesite.com">MarketingClub</a>
in
<a href="http://www.somesite2.com">Marketing</a>
</p>
I need to get the first links included in p tag and the second links included in p tag so using page object I've added the following code:
links(:followees_category, :css => "#home-followees li.animate-in ul li[data-show-id] p.schedule-text a")
...
followees_category_elements.attribute("href")
the last row will give me both links : http://www.somesite2.com, http://www.somesite2.com Unfortunately, I can't indicate in css :last/:first etc.
the second link can be gotten by changing css to :
#home-followees li.animate-in ul li[data-show-id] p.schedule-text a + a
but how can I get just the first links from such blocks? Of course, I can get both links and work with every 2nd, but maybe there is an alternative solution?