title: How to do mouseover function in selenium webdriver using javascript
body: <p>I need to do mouseover function using JavaScript, I have tried the below code am not getting any error but mouseover function not happening.</p>
  
  <pre><code>      WebElement Mainmenu=_driver.findElement(By.xpath(locatorvalue[0]));
      String strJavaScript = "var element = arguments[0];"
              + "var mouseEventObj = document.createEvent('MouseEvents');"
              + "mouseEventObj.initEvent( 'mouseover', true, true );"
              + "element.dispatchEvent(mouseEventObj);";
       JavascriptExecutor js =  (JavascriptExecutor) _driver;
       js.executeScript(strJavaScript, Mainmenu);
  </code></pre>