How to sort div elements in Ruby? (Web Automation, Cucumber, Watir)

I have the following problem - I don’t know how I can sort div elements, which have the same class, same id’s, same name, etc. The only thing that differentiates them are the tags inside them.

I am currently learning web automation and I use a Ruby-Cucumber-Watir automation framework.

Here are the div-elements I have (For simplicity’s sake only 2 elements)

  <div class=“box mid grey“>
    <a href = „#38“>
  </div>

  <div class=“box mid grey“>
    <a href = „#42“>
  </div>

Any help would be greatly appreciated! :slight_smile: