Interaction

Move To

Scrolls a web element into view and moves the real mouse cursor onto it.

Scrolls a web element into view and moves the real mouse cursor onto it.

Scrolls the page so that the specified web element becomes visible and is positioned near the center of the viewport, then moves the mouse cursor onto it using a real input-layer move (OS-level move on Hardware, CDP Input.dispatchMouseEvent on Puppeteer, Actions.MoveToElement on Selenium, the OttoMagic equivalent). Because this is genuine input, CSS :hover state updates and mouseenter/mouseover/mouseleave fire naturally - the same mechanism Hover uses.

TIP

MoveTo and Hover are the same operation - Browser.Hover() is a fluent alias for MoveTo(). MoveTo does not focus the element or place a text caret; use Focus for that (Focus clicks editable elements to focus+place-caret, and falls back to MoveTo for non-editable ones). When no real cursor is available (e.g. headless JS-interaction mode), MoveTo falls back to JavaScriptHover, which dispatches a synthetic mouseover - this only fires JS addEventListener listeners and does NOT update CSS :hover.

Examples

GPAL Fluent: High-level fluent C# API

browser.WithSelector(selector).MoveTo(); browser.MoveTo(selector);

MagicHelper: MagicHelper utility library

GPAL.MagicHelper.MoveTo(string css); GPAL.MagicHelper.MoveTo(string xpath);

Puppeteer Client: Puppeteer-style C# client

browser.PuppeteerClient.MoveTo(string css).Execute(); browser.PuppeteerClient.MoveTo(string xpath).Execute();

Puppeteer Communicator: Low-level communicator

//Resolves the selector to GPALElements, scrolls each into view, and dispatches a real CDP mouseMoved event to a randomized point within each element's bounding box (or dead-center for <a> tags).

await browser.PuppeteerCommunicator.MoveTo(List<GPALElement> elems, string sessionId, List<dynamic> responses);

REST Client: Direct REST/HTTP client

GPAL.OttoMagicClient.WithEndpoint(ApiEndpoint.MoveTo).WithCss(string css).Execute(); GPAL.OttoMagicClient.WithEndpoint(ApiEndpoint.MoveTo).WithXPath(string xpath).Execute();