In the below script , i am trying to click on image having name=jack.
Before to do this, we hav to include OpenQA.Selenium.Interactions namespace
IWebElement element = driver.FindElement(By.XPath("//img[@name='jack']"));
new Actions(driver).MoveToElement(element).Perform(); //Here i am moving driver to that element.
ILocatable loc = (ILocatable)element; // Here i am getting co-ordinates of that element.
IMouse mouse = ((IHasInputDevices)driver).Mouse; // Here i am converting driver as a mouse device.
mouse.Click(loc.Coordinates); //Here driver click on that coordinates.
Before to do this, we hav to include OpenQA.Selenium.Interactions namespace
IWebElement element = driver.FindElement(By.XPath("//img[@name='jack']"));
new Actions(driver).MoveToElement(element).Perform(); //Here i am moving driver to that element.
ILocatable loc = (ILocatable)element; // Here i am getting co-ordinates of that element.
IMouse mouse = ((IHasInputDevices)driver).Mouse; // Here i am converting driver as a mouse device.
mouse.Click(loc.Coordinates); //Here driver click on that coordinates.
It works perfectly for me in chrome and firefox just not working in ie
ReplyDeleteHi Anjaneyulu,
ReplyDeleteI am not able to convert it into JAVA. Please attached same code in JAVA also.
This comment has been removed by the author.
ReplyDelete