views:

179

answers:

1

I've the following html:

<li><a href="/stumbler/millisami/tag/company/" class="">
  <span class="right">69</span>
  company</a>
</li>

and I want to scrap the text after the span tag, i.e. "company"

So, when I tried

doc.at_css("span:after")

the no method error :after is thrown. How to use pseudo selectors with Nokogiri??

+1  A: 

According to the CSS 2.1 standard, the ':before' and ':after' pseudo-elements can be used to insert generated content before or after an element's content, but not to per se select elements.

You can workaround this shortcoming using

doc.at_css("span").next_sibling()
Adrian