title: Using XPath wildcards to access an object using Selenium WebDriver
body: <p>I am having difficulties to access an object with text <strong><em>Current Fund Value</em></strong>.</p>
  
  <p>Using Firebug on Chrome the element's xpath is :</p>
  
  <pre><code>//*[@id="poc"]/div[1]/div[4]/table/tbody/tr[1]/th/a
  </code></pre>
  
  <p>Using Firebug on Firefox the element's xpath is :</p>
  
  <pre><code>/html/body/div[2]/div[9]/div/div/div/div/div[2]/div[1]/div[4]/table/tbody/tr[1]/th/a
  </code></pre>
  
  <p>I tried hard but ( I guess not hard enough ) using below code to access the object which dynamically changes the "div[1]/div[4]" part. Any help will be greatly appreciated:</p>
  
  <pre><code>@FindBy(how = How.XPATH, using = "//a[starts-with(@id, 'poc')] and
  contains[(@text, 'Current Fund Value')]")
  </code></pre>
  
  <p><strong>or</strong></p>
  
  <pre><code>@FindBy(how = How.XPATH, using = "//input[starts-with(@id, 'poc')] and
  contains[(@linktext, 'Current Fund Value')]")
  </code></pre>
  
  <p><strong>or</strong></p>
  
  <pre><code>@FindBy(how = How.XPATH, using = "//input[contains[(@text, 'Current
  Fund Value')]")
  </code></pre>
  
  <p><strong>Here is the HTML</strong> </p>
  
  <pre><code>&lt;table&gt;
     &lt;tbody&gt;
        &lt;tr&gt;
           &lt;th&gt;
              &lt;a class="tooltip abbr"&gt;
              Current Fund Value:
              &lt;/a&gt;
           &lt;/th&gt;
           &lt;td class="value dollar"&gt;&lt;span class="symbol"&gt;$&lt;/span&gt;&lt;span class="amount"&gt;    32,498&lt;/span&gt;&lt;span class="decimal"&gt;&lt;span class="point"&gt;.&lt;/span&gt;&lt;span class="amount"&gt;90&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
        &lt;/tr&gt;
     &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>The way multiple items with same text appear are in different table as  below:</p>
  
  <p><strong>1st table</strong></p>
  
  <pre><code>//*[@id="poc"]/div[1]/div[3]/table[1]/tbody/tr[1]/th/a
  </code></pre>
  
  <p><strong>2nd table</strong></p>
  
  <pre><code>//*[@id="poc"]/div[1]/div[3]/table[2]/tbody/tr[1]/th/a
  </code></pre>
  
  <p><strong>3nd table</strong></p>
  
  <pre><code>//*[@id="poc"]/div[1]/div[3]/table[3]/tbody/tr[1]/th/a
  </code></pre>