title: How i can get the parent id in html code. In selenium webdirver using java
body: <p>how i can get the parent id in following html code. using description class name i want to fetch id of that div.there is card-box class name is common for all the div and id is generated at run time.  </p>
  
  <pre><code> &lt;div id="2321-79" class="card-box"&gt;&lt;/div&gt;
      &lt;div id="2321-32" class="card-box"&gt;&lt;/div&gt;
      &lt;div id="2321-33" class="card-box"&gt;&lt;/div&gt;
      &lt;div id="2321-81" class="card-box"&gt;&lt;/div&gt;
      &lt;div id="2321-74" class="card-box"&gt;&lt;/div&gt;
      &lt;div id="2321-59" class="card-box"&gt;&lt;/div&gt;
      &lt;div id="2321-80" class="card-box"&gt;&lt;/div&gt;
      &lt;div id="2321-35" class="card-box"&gt;&lt;/div&gt;
      &lt;div id="2321-84" class="card-box"&gt;
          &lt;div class="card overdue white"&gt;
              &lt;div class="summary"&gt;&lt;/div&gt;
              &lt;div class="info" style="display: none;"&gt;&lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div id="2321-82" class="card-box"&gt;
          &lt;div class="card overdue white"&gt;
              &lt;div class="summary"&gt;
                  &lt;a class="pic" href="/profiles/219"&gt;&lt;/a&gt;
                  &lt;div class="detail"&gt;
                      &lt;div class="title"&gt;&lt;/div&gt;
                      &lt;span class="description"&gt;&lt;/span&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="info" style="display: block;"&gt;
                  &lt;div class="team"&gt;
                      &lt;table width="100%" style="padding: 0px 10px"&gt;
                          &lt;tbody&gt;
                              &lt;tr&gt;
                                  &lt;td class="from" colspan="4"&gt;
  
  
                                                    From
  
  
                                      &lt;a href="/profiles/219"&gt;&lt;/a&gt;
  
  
                                                    to
  
  
                                      &lt;a href="/profiles/1"&gt;&lt;/a&gt;
                                  &lt;/td&gt;
                              &lt;/tr&gt;
                              &lt;tr&gt;
                                  &lt;td width="20%"&gt;&lt;/td&gt;
                                  &lt;td width="50%"&gt;&lt;/td&gt;
                                  &lt;td width="7%"&gt;&lt;/td&gt;
                                  &lt;td width="20%"&gt;&lt;/td&gt;
                              &lt;/tr&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;&lt;/td&gt;
                                  &lt;td&gt;&lt;/td&gt;
                                  &lt;td&gt;&lt;/td&gt;
                                  &lt;td&gt;&lt;/td&gt;
                              &lt;/tr&gt;
                          &lt;/tbody&gt;
                      &lt;/table&gt;
                  &lt;/div&gt;
                  &lt;div class="actions"&gt;
                      &lt;form method="post" data-remote="true" action="/commitments/get_view" accept-charset="UTF-8"&gt;
                          &lt;div style="margin:0;padding:0;display:inline"&gt;&lt;/div&gt;
                          &lt;input id="col_type" type="hidden" value="col_my_work_commitments" name="col_type"&gt;&lt;/input&gt;
                          &lt;input id="card_id" type="hidden" value="174" name="card_id"&gt;&lt;/input&gt;
                          &lt;input id="state" type="hidden" value="published" name="state"&gt;&lt;/input&gt;
                          &lt;table width="100%"&gt;
                              &lt;tbody&gt;
                                  &lt;tr class="actions"&gt;
                                      &lt;td&gt;
                                          &lt;button id="commitments-identifier" type="submit" name="btn_discuss"&gt;&lt;/button&gt;
                                      &lt;/td&gt;
                                  &lt;/tr&gt;
                              &lt;/tbody&gt;
                          &lt;/table&gt;
                      &lt;/form&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p></p>
  
  <p>for this i m tried this code</p>
  
  <pre><code>    String val1 = "Final";
      List&lt;WebElement&gt; resultList1 = card1.findElements(By.className("description"));
      for (WebElement resultItem : resultList1){
             String tabname=resultItem.getText();
             if(tabname.contentEquals(val1))
             {
                 System.out.println(description.getAttribute("id"));
                 resultItem.click();                 
                 break;
             }
             }
  </code></pre>