NoSuchElementException on performing Mousehover action in selenium
<p>I have a webpage in which I am trying to perform a mouse hover.. There is an element named "Entity Records" on which if you hover your mouse it displays a menu. In that menu I need to click on an element named Create New record.</p>

<p>I have tried 3 different set of codes but it's not working for me..</p>

<p>1st One:</p>

<pre><code> WebElement el = driver.findElement(By.xpath("\\...."));
    action.moveToElement(el).build().perform();
    Actions builder = new Actions(driver);
    builder.moveToElement(driver.findElement(By.cssSelector("..."))).click().build().perform();
</code></pre>

<p>2nd one: </p>

<pre><code>WebElement entityrecordsmenu = driver.findElement(By.cssSelector("..."));
    Actions builder = new Actions(driver);
    builder.moveToElement(entityrecordsmenu).build().perform();
    WebElement createnewrecord = driver.findElement(By.cssSelector("..."));
    createnewrecord.click();
</code></pre>

<p>3rd one:</p>

<pre><code>Actions action2 = new Actions(driver);
    WebElement ele = driver.findElement(By.xpath("...));
    action2.moveToElement(ele).build().perform();
    Actions build2 = new Actions(driver);
    build2.moveToElement(driver.findElement(By.xpath("..."))).click().build().perform();
</code></pre>

<p>1st and 2nd code are doing the mouse hover fine, but its not clicking on the menu element. Can anyone suggest me the correct way of doing this?</p>