title: How to access the first element of an array and click the same at runtime using selenium web driver?
body: <p>I have a drop list as id="product-size" and the items S,M,L,XL.</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;select id="product-size" onchange=" addToWishList();"&gt;
   &lt;option&gt;Select&lt;/option&gt;
   &lt;option id="2119362" value="4"&gt;S&lt;/option&gt;
   &lt;option id="2119363" value="7"&gt;M&lt;/option&gt;
   &lt;option id="2119364" value="8"&gt;L&lt;/option&gt;
   &lt;option id="2119365" value="4"&gt;XL&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I have used an array to store these items and at Runtime I need to access the first element 'S'.The problem I am facing is ,I was not able to click on the first element S at runtime.
  I have written the code as follows :</p>
  
  <pre class="lang-java prettyprint-override"><code>driver.get("https://m.staging.karmaloop.com/product/The-Infinity-Tee/407819");
  WebElement j =driver.findElement(By.id("product-size"));
  String text = j.getText(); 
  String[] DDLcount =text.split("\n");
  for (int i=1;i&lt;=DDLcount.length-1;i++)
      {       
      driver.findElement(By.xpath(Testconfiguration.size_dropdown_10deep)).click();
      Thread.sleep(5000);
      driver.findElement(By.name(DDLcount[i])).click(); 
      }
  </code></pre>
  
  <p>Can anyone help me to sort out this problem  ?</p>