title: Selenium click on javascript href
body: <p>I'm facing an issue writing a Selenium program using Java.</p>
  
  <p>I'm trying to click the following link :</p>
  
  <pre><code>&lt;a href="javascript:" id="helkaSubmit" class="ProductsSearch blueButton" title="בצע חיפוש גוש וחלקה לפי כתובת"&gt;חפש&lt;/a&gt;
  </code></pre>
  
  <p>by using the following code:</p>
  
  <pre><code>WebDriver driver = new HtmlUnitDriver();
  
  driver.get("http://mapi.gov.il/Pages/LotAddressLocator.aspx");
  ((HtmlUnitDriver) driver).setJavascriptEnabled(true);
  WebElement element = driver.findElement(By.id("AddressInput"));
  element.sendKeys("הנגיד 16");
  WebElement button = driver.findElement(By.id("helkaSubmit"));
  button.click();
  String pageSource=driver.getPageSource();
  System.out.println(pageSource);
  </code></pre>
  
  <p>But it doesn't seems like the button was clicked at all, since the page content which must change after clicking the link, does not change at all.</p>
  
  <p>I need to find a way to check whether the link was clicked at all, or to find why it was not clicked.
  Can anyone point me to the solution ? </p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Using <code>executor.executeScript("document.getElementById('helkaSubmit').href='http://www.google.co.il';");
  executor.executeScript("document.getElementById('helkaSubmit').click();");
  </code>
  Worked just fine, so  javascript is enabled and clicking is executed, but for some reason the original code does nothing.</p>