title: How to retrieve the dynamic value in selenium webdriver
body: <p>I'm trying to create the test cases using Selenium WebDriver with Java.  I have the following HTML syntax in the source.</p>
  
  <pre><code>&lt;label for="00N30000005wfev"&gt;&lt;span class=class="requiredMark"&gt;*&lt;/span&gt;Type&lt;/label&gt;
  &lt;select id="00N30000005wfev" tabindex="34" name="00N30000005wfev"&gt;
  &lt;option value="Account"&gt;Account&lt;/option&gt;
  &lt;option value="Client"&gt;Client&lt;/option&gt;
  &lt;option value="Service"&gt;Service&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>All the "for","id" and "name" value are dynamically generated when the application creates a new item every time. The label name is fixed for the item details. How can I dynamically retrieve this value based on the label name value (e.g. Type)?</p>
  
  <p>When Java runs, it will look at the "Type" label first, then it will be able to find the "for" value.</p>
  
  <p>Thanks</p>