title: Selenium WebDriver: Java: NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//div[@id='manage_area']/ul/li/div[2]"}
body: <p>I'm having a real hard time interacting with this element.  I've used <code>FirePath</code>, Selenium IDE, and manual construction of an XPATH to no avail.  I'm trying to interact with "Group Accident".  I can get Selenium to detect "Accident" by using <code>driver.findElement(By.xpath("//div[@id='manage_area']/ul/li/div")).click();</code></p>
  
  <p>I want to be able to open the menu and select "Add or View Plan/Options" from Group Accident.
  <a href="http://i.imgur.com/gHMaXLl.jpg" rel="nofollow">http://i.imgur.com/gHMaXLl.jpg</a></p>
  
  <p>Please help! Thanks.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>@Test
    public void testAddEEBenefitsinCOLO() throws Exception {
      driver.get(baseUrl + "/bcs/stored.asp");
      driver.findElement(By.id("TBUserName")).clear();
      driver.findElement(By.id("TBUserName")).sendKeys("test");
      driver.findElement(By.name("TBPassword")).clear();
      driver.findElement(By.name("TBPassword")).sendKeys("pw1");
      driver.findElement(By.name("Login")).click();
      Thread.sleep(2000);
      driver.findElement(By.name("TBPARAM")).click();
      driver.findElement(By.name("TBPARAM")).clear();
      driver.findElement(By.name("TBPARAM")).sendKeys("colo1973");
      driver.findElement(By.name("TBPARAM")).sendKeys(Keys.ENTER);
      driver.findElement(By.id("QRY")).click();
      driver.findElement(By.id("QRY")).clear();
      driver.findElement(By.id("QRY")).sendKeys("Melvin");
      driver.findElement(By.name("B1")).click();
      Thread.sleep(5000);
  
      driver.findElement(By.xpath("//div[@id='manage_area']/ul/li/div[2]")).click();
      Thread.sleep(1000);
  </code></pre>
  
  <p>Error message:</p>
  
  <pre><code>org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//div[@id='manage_area']/ul/li/div[2]"}
  Command duration or timeout: 30.01 seconds
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="spAbove"&gt;
  &lt;/div&gt;
  
  &lt;div class="tableholder" id="ben110119014" style="width: 99%"&gt;
  
          &lt;form method="post" id="submitform110119014" action="EnrollChange.asp" name="ACCIDENT"
              onsubmit="JavaScript: return validateChangeType(this); "&gt;
              &lt;input type="hidden" name="TARGET" value="110119014" /&gt;
  
                      &lt;h3&gt;
                      &lt;span onmouseover="javascript:showtip('BC110119014')"&gt;
                      Accident
                      &lt;/span&gt;
                      &lt;div id="manage_area" style="margin-left: -5px; visibility: hidden; display: inline;"&gt;
                          &lt;a href="javascript:spawn_window('glossary.asp?PPVS=COLO1973#0','600','800','',0)"
                          title="What's this?"&gt;
                          &lt;img src="images/help.gif" border="0"&gt;&lt;/a&gt;
                      &lt;/div&gt;
  
                      &lt;/h3&gt;
  
                      &lt;table class="textNormal sp" width="100%" border="0" cellspacing="0" cellpadding="0"&gt;
                          &lt;tbody&gt;
                          &lt;tr&gt;
  
                              &lt;td class="tdata" valign="middle"&gt;
                                  &lt;input type="hidden" name="CHANGETYPE" id="Hidden1" value="0" /&gt;
  
                                      &lt;div id="manage_area"&gt;
                                          &lt;ul class="menuUL opMenu" title="Click here to view your options"&gt;
                                              &lt;li class="menuLI width225"&gt;
  
                                              &lt;div class="titleCell optImg" title="Click here to view your options"&gt;  
  
                                                  &lt;ul class="menuUL MainOptSubMenu"&gt;
  
                                                                  &lt;li class="menuLI"&gt;&lt;a href="javascript: submitBenefit('16', 'submitform110119014'); "
                                                                  value="16"&gt;
                                                                  Add: Initial Population&lt;/a&gt;&lt;/li&gt;
  
                                                                  &lt;li class="menuLI"&gt;&lt;a href="javascript: submitBenefit('46', 'submitform110119014'); "
                                                                  value="46"&gt;
                                                                  Decline Benefit: (Prompt Effective)&lt;/a&gt;&lt;/li&gt;
  
                                                                  &lt;li class="menuLI"&gt;&lt;a href="javascript: submitBenefit('81', 'submitform110119014'); "
                                                                  value="81"&gt;
                                                                  Add or View Plan/Options&lt;/a&gt;&lt;/li&gt;
  
                                                                  &lt;li class="menuLI"&gt;&lt;a href="javascript: submitBenefit('64', 'submitform110119014'); "
                                                                  value="64"&gt;
                                                                  Decline Benefit&lt;/a&gt;&lt;/li&gt;
  
                                                  &lt;/ul&gt;
                                              &lt;/div&gt;
                                              &lt;/li&gt;
                                          &lt;/ul&gt;
                                      &lt;/div&gt;
  
                              &lt;/td&gt;
                          &lt;/tr&gt;
  
  
  
  
  
                          &lt;/tbody&gt;
                      &lt;/table&gt;
  
          &lt;/div&gt;
          &lt;p align="right" class="backtotop"&gt;
              &lt;a href="#PAGETOP"&gt;To Top&lt;/a&gt;&lt;/p&gt;
          &lt;input type="hidden" name="TRANSID" value="5327418"&gt;
          &lt;input type="hidden" name="PPVS" value="COLO1973"&gt;
          &lt;input type="hidden" name="HST" value="SITE,BENEFITS,"&gt;
          &lt;input type="hidden" name="PF" value="BENEFITS"&gt;
          &lt;input type="hidden" name="SK" value="140062328"&gt;
          &lt;input type="hidden" name="BENCAT" value="ACCIDENT"&gt;
          &lt;input type="hidden" name="CANCHANGE" value=""&gt;
      &lt;/form&gt;
  
  &lt;div class="tableholder" id="ben167876400" style="width: 99%"&gt;
  
          &lt;form method="post" id="submitform167876400" action="EnrollChange.asp" name="GRPACC"
              onsubmit="JavaScript: return validateChangeType(this); "&gt;
              &lt;input type="hidden" name="TARGET" value="167876400" /&gt;
  
                      &lt;h3&gt;
                      &lt;span onmouseover="javascript:showtip('BC167876400')"&gt;
                      Group Accident
                      &lt;/span&gt;
                      &lt;div id="manage_area" style="margin-left: -5px; visibility: hidden; display: inline;"&gt;
                          &lt;a href="javascript:spawn_window('glossary.asp?PPVS=COLO1973#0','600','800','',0)"
                          title="What's this?"&gt;
                          &lt;img src="images/help.gif" border="0"&gt;&lt;/a&gt;
                      &lt;/div&gt;
  
                      &lt;/h3&gt;
  
                      &lt;table class="textNormal sp" width="100%" border="0" cellspacing="0" cellpadding="0"&gt;
                          &lt;tbody&gt;
                          &lt;tr&gt;
  
                              &lt;td class="tdata" valign="middle"&gt;
                                  &lt;input type="hidden" name="CHANGETYPE" id="Hidden1" value="0" /&gt;
  
                                      &lt;div id="manage_area"&gt;
                                          &lt;ul class="menuUL opMenu" title="Click here to view your options"&gt;
                                              &lt;li class="menuLI width225"&gt;
  
                                              &lt;div class="titleCell optImg" title="Click here to view your options"&gt;  
  
                                                  &lt;ul class="menuUL MainOptSubMenu"&gt;
  
                                                                  &lt;li class="menuLI"&gt;&lt;a href="javascript: submitBenefit('16', 'submitform167876400'); "
                                                                  value="16"&gt;
                                                                  Add: Initial Population&lt;/a&gt;&lt;/li&gt;
  
                                                                  &lt;li class="menuLI"&gt;&lt;a href="javascript: submitBenefit('46', 'submitform167876400'); "
                                                                  value="46"&gt;
                                                                  Decline Benefit: (Prompt Effective)&lt;/a&gt;&lt;/li&gt;
  
                                                                  &lt;li class="menuLI"&gt;&lt;a href="javascript: submitBenefit('81', 'submitform167876400'); "
                                                                  value="81"&gt;
                                                                  Add or View Plan/Options&lt;/a&gt;&lt;/li&gt;
  
                                                                  &lt;li class="menuLI"&gt;&lt;a href="javascript: submitBenefit('64', 'submitform167876400'); "
                                                                  value="64"&gt;
                                                                  Decline Benefit&lt;/a&gt;&lt;/li&gt;
  
                                                  &lt;/ul&gt;
                                              &lt;/div&gt;
                                              &lt;/li&gt;
                                          &lt;/ul&gt;
                                      &lt;/div&gt;
  
                              &lt;/td&gt;
                          &lt;/tr&gt;
  
  
  
  
  
                          &lt;/tbody&gt;
                      &lt;/table&gt;
  
          &lt;/div&gt;
  </code></pre>