Tuesday, November 5, 2013

Problems with mouseover / mouse hover - Selenium Webdriver

Recently I had been having troubles simulating mouse over on chrome browser, the solution however was pretty simple , I was providing incorret xpath

Replacing //*[@id='rightContainer']/nav/ul/li[5]/a

with
//*[@id='rightContainer']/nav/ul/li[5]

worked for me , so rather hovering over link, i hovered over the list containing it, and the code remains as available widely:

    pcs_element= get_element(driver, objects_ob_identity_type, objects_ob_identity_val, steps_ob_name);
                                            
                        Actions builder = new Actions(driver);
                        org.openqa.selenium.Point coordinate=pcs_element.getLocation();
                        Robot robot=new Robot();
                        builder.moveToElement(pcs_element, 5,5).build().perform();
                        builder.moveByOffset(1, 1).build().perform();
                        robot.mouseMove(coordinate.getX()+8,coordinate.getY()+60);
                       

would appreciate a thanks if this helped:)

No comments:

Post a Comment

I welcome your comment, will respond and post it at the earliest:)