.moveTo() Suggest edits
Since: 3.0.0Move the mouse by an offset of the specified element. If an element is provided but no offset, the mouse will be moved to the center of the element. If the element is not visible, it will be scrolled into view.
For more info on working with DOM elements in Nightwatch, refer to the Finding & interacting with DOM Elements guide page.
This command has been deprecated and is not available when using W3C Webdriver clients (such as GeckoDriver). It's only available when using the Selenium JSONWire Protocol.
Usage
browser.element(selector).moveTo([x], [y])
Example
export default {
demoTest(browser: NightwatchAPI): void {
browser.element('#main').moveTo(10, 10);
},
async demoTestAsync(browser: NightwatchAPI): Promise<void> {
await browser.element('#main').moveTo(10, 10);
}
}
Parameters
Name | Type | description |
---|---|---|
x=0 Optional |
number | X offset to move to, relative to the center of the element. |
y=0 Optional |
number | Y offset to move to, relative to the center of the element |
Returns
Type | description |
---|---|
ScopedWebElement |