Monday, July 8, 2013

Mouse click event in WebDriver

Due to changes in UI frameworks , some of the elements click operation wont have any didnt trigger any event. We may need to pass "onMouseClick" operation. And that can be achieved using the following code:

Ex: ListboxView (For user view it looks like listbox but ..)

            Mouse mouse = ((HasInputDevices) driver).getMouse();
            Locatable hoverItem = (Locatable) listoption;
            mouse.mouseDown(hoverItem.getCoordinates());
            mouse.mouseUp(hoverItem.getCoordinates());