/** * Simulates moving the mouse over this element, returning the page which this element's window contains * after the mouse move. The returned page may or may not be the same as the original page, depending * on JavaScript event handlers, etc. * * @return the page which this element's window contains after the mouse move */ public Page mouseOver() { return mouseOver(false, false, false, MouseEvent.BUTTON_LEFT); }
/** * Simulates moving the mouse over this element, returning the page which this element's window contains * after the mouse move. The returned page may or may not be the same as the original page, depending * on JavaScript event handlers, etc. * * @return the page which this element's window contains after the mouse move */ public Page mouseOver() { return mouseOver(false, false, false, MouseEvent.BUTTON_LEFT); }
/** * Simulates moving the mouse over this element, returning the page which this element's window contains * after the mouse move. The returned page may or may not be the same as the original page, depending * on JavaScript event handlers, etc. * * @return the page which this element's window contains after the mouse move */ public Page mouseOver() { return mouseOver(false, false, false, MouseEvent.BUTTON_LEFT); }
/** * {@inheritDoc} */ @Override public Page mouseOver(final boolean shiftKey, final boolean ctrlKey, final boolean altKey, final int button) { final SgmlPage page = getPage(); if (page.getWebClient().getBrowserVersion().hasFeature(EVENT_ONMOUSEOVER_NEVER_FOR_SELECT_OPTION)) { return page; } return super.mouseOver(shiftKey, ctrlKey, altKey, button); }
/** * {@inheritDoc} */ @Override public Page mouseOver(final boolean shiftKey, final boolean ctrlKey, final boolean altKey, final int button) { final SgmlPage page = getPage(); if (page.getWebClient().getBrowserVersion().hasFeature(EVENT_ONMOUSEOVER_NEVER_FOR_SELECT_OPTION)) { return page; } return super.mouseOver(shiftKey, ctrlKey, altKey, button); }
element.focus(); element.mouseOver(); element.mouseMove();
private void mouseMove(HtmlElement element) { element.mouseMove(keyboard.isShiftPressed(), keyboard.isCtrlPressed(), keyboard.isAltPressed(), MouseEvent.BUTTON_LEFT); element.mouseOver(keyboard.isShiftPressed(), keyboard.isCtrlPressed(), keyboard.isAltPressed(), MouseEvent.BUTTON_LEFT); }
private void moveOutIfNeeded(HtmlElement element) { try { if ((currentActiveElement != element)) { if (currentActiveElement != null) { currentActiveElement.mouseOver(keyboard.isShiftPressed(), keyboard.isCtrlPressed(), keyboard.isAltPressed(), MouseEvent.BUTTON_LEFT); currentActiveElement.mouseOut(keyboard.isShiftPressed(), keyboard.isCtrlPressed(), keyboard.isAltPressed(), MouseEvent.BUTTON_LEFT); currentActiveElement.blur(); } if (element != null) { mouseMove(element); } } } catch (ScriptException ignored) { System.out.println(ignored.getMessage()); } }
@Override public void click(Coordinates elementCoordinates) { HtmlElement element = getElementForOperation(elementCoordinates); moveOutIfNeeded(element); try { element.mouseOver(); element.mouseMove(); element.click(keyboard.isShiftPressed(), keyboard.isCtrlPressed(), keyboard.isAltPressed()); updateActiveElement(element); } catch (IOException e) { throw new WebDriverException(e); } catch (ScriptException e) { // TODO(simon): This isn't good enough. System.out.println(e.getMessage()); // Press on regardless } }