0

I am trying to use Nokogiri's CSS method to get some names from my HTML.

This is an example of the HTML:

<section class="container partner-customer padding-bottom--60">
    <div>
        <div>
            <a id="technologies"></a>
            <h4 class="center-align">The Team</h4>
        </div>
    </div>
    <div class="consultant list-across wrap">
        <div class="engineering">
            <img class="" src="https://v0001.jpg" alt="Person 1"/>
            <p>Person 1<br>Founder, Chairman &amp; CTO</p>
        </div>
        <div class="engineering">
            <img class="" src="https://v0002.png" alt="Person 2"/></a>
            <p>Person 2<br>Founder, VP of Engineering</p>
        </div>
        <div class="product">
            <img class="" src="https://v0003.jpg" alt="Person 3"/></a>
            <p>Person 3<br>Product</p>
        </div>
        <div class="Human Resources &amp; Admin">
            <img class="" src="https://v0004.jpg" alt="Person 4"/></a>
            <p>Person 4<br>People &amp; Places</p>
        </div>
        <div class="alliances">
            <img class="" src="https://v0005.jpg" alt="Person 5"/></a>
            <p>Person 5<br>VP of Alliances</p>
        </div>

What I have so far in my people.rake file is the following:

  staff_site = Nokogiri::HTML(open("https://www.website.com/company/team-all"))
  all_hands = staff_site.css("").map(&:text).map(&:squish)

I am having a little trouble getting all elements within the alt="" tag (the name of the person), as it is nested under a few divs. I was wondering if anyone could give me some assistance on this?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
theGreenCabbage
  • 5,197
  • 19
  • 79
  • 169
  • 1
    Possible duplicate of [Using Nokogiri's CSS method to get all elements within an alt tag](http://stackoverflow.com/questions/39129327/using-nokogiris-css-method-to-get-all-elements-within-an-alt-tag) – the Tin Man Aug 24 '16 at 22:41
  • Please don't duplicate questions. Ask it once, well, and you'll get help. Asking repeatedly will only get you into trouble. – the Tin Man Aug 24 '16 at 22:42

0 Answers0