title: How do I click an li inside a ul using Selenium Webdriver
body: <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>public void testHolidayLink() {
  
   // login
    driver.findElement(By.id("ctl00_MCPH_MainLogin_UserNameTextBox")).sendKeys("username");
    driver.findElement(By.id("ctl00_MCPH_MainLogin_PasswordTextBox")).sendKeys("password");
    driver.findElement(By.id("ctl00_MCPH_MainLogin_LoginButton")).click();
  // click book holiday
    
    driver.findElement(By.xpath(".//*[@id='AddInMyQuickLinks']/div/span/ul/li[1]/h3/a")).click();
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>I'm trying to click an li inside a ul using xpath, im trying to use this</p>
  
  <p><code>driver.findElement(By.xpath("//div[@class='indent'/ul/li[1]a")).click();</code></p>
  
  <p>but it can't seem to find the element</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="AddIn  atScreens AddInViewportDESKTOP"&gt;
    &lt;div style="width:100%;" data-role="collapsible" class="AddInCollapsible ui-accordion ui-widget ui-helper-reset" id="AddInMyQuickLinks" role="tablist"&gt;
      &lt;h2 class="AddinTitleBar ui-accordion-header ui-helper-reset ui-state-default ui-accordion-header-active ui-state-active ui-corner-top ui-accordion-icons" role="tab" id="ui-accordion-AddInMyQuickLinks-header-0" aria-controls="ui-accordion-AddInMyQuickLinks-panel-0"
      aria-selected="true" tabindex="0"&gt;&lt;span class="ui-accordion-header-icon ui-icon ui-icon-triangle-1-s"&gt;&lt;/span&gt;My Quick Links&lt;/h2&gt;
      &lt;div class="AddInMain ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active" style="display: block;" id="ui-accordion-AddInMyQuickLinks-panel-0" aria-labelledby="ui-accordion-AddInMyQuickLinks-header-0"
      role="tabpanel" aria-expanded="true" aria-hidden="false"&gt;
        &lt;span&gt;&lt;ul class="NoIndent"&gt;&lt;li class="NoBullet jms-bullet"&gt;&lt;h3&gt;&lt;a href="javascript:ShowSelectedAddInScreen('-1','32f3c56c-5660-488c-b348-07552ea7d299','0','false',false,'false',true, 'Update Personal Details','e1ff7f13-59fe-4bfc-842d-64a33b0dd98f','b0ab7c0f-bd9d-4f0d-9d1e-508b414ab9ec');"&gt;&lt;img alt="Update My Details" src="..\Images\hr.png"&gt;Update My Details &lt;span title="Keep your personal information up to date" class="AddInItemDescription"&gt;Keep your personal information up to date &lt;/span&gt;
        &lt;/a&gt;
        &lt;/h3&gt;
        &lt;/li&gt;
        &lt;li class="NoBullet jms-bullet"&gt;
          &lt;h3&gt;&lt;a href="javascript:ShowSelectedAddInScreen('-1','8142758e-269a-41f0-b551-433e56dd1225','0','false',false,'false',true, 'Submit a Holiday','e1ff7f13-59fe-4bfc-842d-64a33b0dd98f','4c1ea925-69e5-4950-aeae-18e8493fefd1');"&gt;&lt;img alt="Book a Holiday" src="../Style Sheets/images/Holiday114.png"&gt;Book a Holiday &lt;span title="Place a request for a holiday" class="AddInItemDescription"&gt;Place a request for a holiday &lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
        &lt;/li&gt;
        &lt;li class="NoBullet jms-bullet"&gt;
          &lt;h3&gt;&lt;a href="javascript:ShowSelectedAddInScreen('D4292FDC-7213-464C-9C96-019BD67C12DA','bebbb0b6-5328-4737-9709-f389f065db8b','0','false',false,'false',false, 'Employee Mobility','e1ff7f13-59fe-4bfc-842d-64a33b0dd98f','');"&gt;&lt;img alt="My Mobility" src="..\Images\hr.png"&gt;My Mobility &lt;span title="Places where I would work" class="AddInItemDescription"&gt;Places where I would work &lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
        &lt;/li&gt;
        &lt;/ul&gt;
        &lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>And this is the full xpath</p>
  
  <p><code>/html/body/form[1]/div[3]/div[2]/div[1]/div/span[2]/div/div/div/span/ul/li[2]/h3/a</code></p>
  
  <p>The div has an id which I think i can use to get to the li inside the span but I have no idea how. Apologies if I have not provided the information correctly its my first time posting so please do leave feedback in how I can structure my questions better so as to make it easier for people.</p>