moveToElement(element,xoffset,yoffset) not working in selenium webdriver 2.32.0
I had the same issue. Using ClickAndHold()
and Release()
worked when Click()
did not. I also like using percentages on any x,y coordinates so they are relative. May or may not help you. C# below.
IWebElement MarkAs = MarkAsSpan(driver).FindElement(By.Id("btnMarkAs")); int Width = MarkAs.Size.Width; int Height = MarkAs.Size.Height; int MyX = (Width * 95) / 100;//spot to click is at 95% of the width int MyY = 1;//anywhere above Height/2 works Actions Actions = new Actions(driver); Actions.MoveToElement(MarkAs,MyX,MyY); Actions.ClickAndHold(); Actions.Release(); Actions.Perform();
Similar problem i solved by using below code may be this helpful for you,Try first find out the x and y offset.
driver= new FirefoxDriver(); driver.manage().window().maximize(); driver.get("http://dev.sencha.com/deploy/ext-4.0.0/examples/toolbar/toolbars.html"); driver.findElement(By.xpath("//em")).click(); System.out.println(driver.findElement(By.xpath("//em")).getSize()); Actions action = new Actions(driver); action.moveToElement(driver.findElement(By.xpath("//em")), 97, 16).click().build().perform();
Mrunal,
With the help of below code, you will be able to move your mouse in webdriver(java)
Actions actions = new Actions(driver);WebElement imageSpan = driver.findElement(By.className("badgeFeatured"));actions.moveToElement(imageSpan);WebElement subLink = driver.findElement(By.cssSelector("#headerMenu .subLink"));actions.moveToElement(subLink);actions.click();actions.perform();