Package org.openqa.selenium.htmlunit
Class HtmlUnitMouse
- java.lang.Object
-
- org.openqa.selenium.htmlunit.HtmlUnitMouse
-
public class HtmlUnitMouse extends Object
Provides basic mouse interaction support forHtmlUnitDriver.This class handles element activation, focus changes, and simple event dispatching needed to emulate mouse behavior within HtmlUnit's DOM model. It is typically used internally by the HtmlUnit-backed WebDriver implementation and is not intended for direct user instantiation.
- Author:
- Simon Stewart, Alexei Barantsev, Ahmed Ashour, Ronald Brill, Martin Bartoš
-
-
Constructor Summary
Constructors Constructor Description HtmlUnitMouse(HtmlUnitDriver parent, HtmlUnitKeyboard keyboard)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclick(org.openqa.selenium.interactions.Coordinates elementCoordinates)Performs a mouse click on the element represented by the givenCoordinates.voidcontextClick(org.openqa.selenium.interactions.Coordinates elementCoordinates)Performs a context (right) click on the element identified by the givenCoordinates.voiddoubleClick(org.openqa.selenium.interactions.Coordinates elementCoordinates)Performs a double-click action on the element identified by the givenCoordinates.voidmouseDown(org.openqa.selenium.interactions.Coordinates elementCoordinates)Performs a mouse-down (button press) action on the element indicated by the givenCoordinates.voidmouseMove(org.openqa.selenium.interactions.Coordinates elementCoordinates)Moves the mouse cursor to the element referenced by the specifiedCoordinates.voidmouseMove(org.openqa.selenium.interactions.Coordinates where, long xOffset, long yOffset)Moves the mouse to the specified coordinates with an additional X/Y offset.voidmouseUp(org.openqa.selenium.interactions.Coordinates elementCoordinates)Performs a mouse-up (button release) action on the element indicated by the givenCoordinates.
-
-
-
Constructor Detail
-
HtmlUnitMouse
public HtmlUnitMouse(HtmlUnitDriver parent, HtmlUnitKeyboard keyboard)
- Parameters:
parent- the owning driver instance; must not benullkeyboard- the keyboard device used to coordinate input state; must not benull
-
-
Method Detail
-
click
public void click(org.openqa.selenium.interactions.Coordinates elementCoordinates)
Performs a mouse click on the element represented by the givenCoordinates.The coordinates are resolved into the corresponding
DomElement, which is then clicked using the parentHtmlUnitDriver. This method triggers the standard HtmlUnit click behavior, including event dispatch and potential navigation.- Parameters:
elementCoordinates- the coordinates identifying the target element; may not benull- Throws:
org.openqa.selenium.NoSuchElementException- if no corresponding element can be resolved from the provided coordinates
-
doubleClick
public void doubleClick(org.openqa.selenium.interactions.Coordinates elementCoordinates)
Performs a double-click action on the element identified by the givenCoordinates. The coordinates are resolved to aDomElement, and the click is forwarded to the parentHtmlUnitDriver.- Parameters:
elementCoordinates- the coordinates representing the target element; must not benull- Throws:
org.openqa.selenium.NoSuchElementException- if no corresponding element can be resolved
-
contextClick
public void contextClick(org.openqa.selenium.interactions.Coordinates elementCoordinates)
Performs a context (right) click on the element identified by the givenCoordinates. The element is resolved and then interacted with using HtmlUnit’s right-click event dispatch.- Parameters:
elementCoordinates- the coordinates of the element to right-click; must not benull
-
mouseDown
public void mouseDown(org.openqa.selenium.interactions.Coordinates elementCoordinates)
Performs a mouse-down (button press) action on the element indicated by the givenCoordinates. The resolved element is forwarded to the driver for processing.- Parameters:
elementCoordinates- the coordinates identifying the target element; must not benull
-
mouseUp
public void mouseUp(org.openqa.selenium.interactions.Coordinates elementCoordinates)
Performs a mouse-up (button release) action on the element indicated by the givenCoordinates. The resolved element is delegated to the driver for handling.- Parameters:
elementCoordinates- the coordinates identifying the target element; must not benull
-
mouseMove
public void mouseMove(org.openqa.selenium.interactions.Coordinates elementCoordinates)
Moves the mouse cursor to the element referenced by the specifiedCoordinates. The element is obtained from the coordinates and delegated to the driver.- Parameters:
elementCoordinates- the coordinates whose auxiliary object identifies the target element; must not benull
-
mouseMove
public void mouseMove(org.openqa.selenium.interactions.Coordinates where, long xOffset, long yOffset)Moves the mouse to the specified coordinates with an additional X/Y offset.HtmlUnit does not support arbitrary coordinate-based mouse positioning, so this operation is not available.
- Parameters:
where- the base coordinates; ignoredxOffset- the horizontal offset; ignoredyOffset- the vertical offset; ignored- Throws:
UnsupportedOperationException- always, as coordinate-based movement is not supported
-
-