> On Oct 16, 2018, at 4:19 AM, fugee ohu <
fuge...@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