title: How to get index of parent element using Watir Webdriver?
body: <p>I have this HTMLcode:</p>
  
  <pre><code>&lt;div class="A"&gt;
    &lt;div class="B"&gt;
      Text1
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="A"&gt;
    &lt;div class="B"&gt;
      Text2
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>So i need to find index of div class='A' where i find some text. I use Watir Webdriver and now i have this code:</p>
  
  <pre><code>if @ff.div(:class=&gt;'A').div(:text=&gt;'Text1')
    then ind=@ff.div(:class=&gt;'A').index
  end
  </code></pre>
  
  <p>but of course this doesn't work saying 'undefined local variable or method `index''.</p>