> On Oct 16, 2018, at 4:19 AM, fugee ohu <fugee279@gmail.com> wrote:
>
> How can i find <li class="data-brand"> using nokogiri after running Nokogiri::HTML::Parse
Two options, both using the CSS syntax:
@doc = Nokogiri::HTML.parse(...)
1. Get all of the elements that match that selector:
@doc.css('li.data-brand').each do |elm|
# do whatever with elm here
end
2. Get the first one in document source order:
elm = @doc.at_css('li.data-brand')
Walter
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0CE4AAFD-13B1-4F69-A202-04F52C725937%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment