title: selenium in java cannot click on a href="javascript:void(0);"
body: <p>This is the piece of code which I am working on.I am trying to click on sub menu.</p>
  
  <pre><code>&lt;ul class="accordion"&gt;
       &lt;li id="one1" class="files"&gt;
         &lt;a href="#one1"&gt;Accounts&lt;/a&gt;
         &lt;ul class="sub-menu"&gt;
         &lt;li&gt;
  
                 &lt;a href="#one1" onClick="loadTabv2('accounts/LoadAccountGroupMaster',
                    'Account Group','accounts_account_group');"&gt;&lt;img src="layouts/static/image/micons/account_group.png"&gt;Account Group&lt;/a&gt;
  
                 &lt;a href="#one1" onClick="loadTabv2('accounts/AccountingPeriod',
                    'Accounting Period','account_accounting_period');"&gt;&lt;img src="layouts/static/image/micons/accounting_period.png"&gt;Accounting Period&lt;/a&gt;
  
                     &lt;a href="javascript:void(0);" onClick="loadTab('accounts/LoadAccountMaster',
                   'Account Master','account_account_master');"&gt; &lt;img src="layouts/static/image/micons/account_master.png"&gt;Account Master&lt;/a&gt;
  
                     &lt;a href="javascript:void(0);" onClick="loadTab('accounts/AccountsDashboard',
                   'Accounts Dashboard','accounts_dashboard');"&gt; &lt;img src="layouts/static/image/micons/accounts_dashboard.png"&gt;Accounts Dashboard&lt;/a&gt;
  
                     &lt;a href="javascript:void(0);" onClick="loadTab('accounts/AccountSettings',
                   'Account Settings','accounts_account_settings');"&gt; &lt;img src="layouts/static/image/micons/account_settings.png"&gt;Account Settings&lt;/a&gt;
  </code></pre>
  
  <p>I am trying to click on account group and accounts dashboard.Neither of them are receiving clicks.Tried this code and failed.</p>
  
  <pre><code>List&lt;WebElement&gt; submenus=driver.findElements(By.xpath("//li[@id='one1']//li//a"));
   for (WebElement submenu: submenus) {
  System.out.println("values of each submodule : 
  "+submenu.getAttribute("innerHTML"));
  driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
  if (submenu.getAttribute("innerHTML").contains("Accounts Dashboard")) {
    submenu.click();
    break;
  }
  </code></pre>