MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / moveCursorTo

Method moveCursorTo

lib/helper/Playwright.js:1501–1524  ·  view source on GitHub ↗

* {{> moveCursorTo }} *

(locator, offsetX = 0, offsetY = 0)

Source from the content-addressed store, hash-verified

1499 *
1500 */
1501 async moveCursorTo(locator, offsetX = 0, offsetY = 0) {
1502 let context = null
1503 if (typeof offsetX !== 'number') {
1504 context = offsetX
1505 offsetX = 0
1506 }
1507
1508 let el
1509 if (context) {
1510 const contextEls = await this._locate(context)
1511 assertElementExists(contextEls, context, 'Context element')
1512 el = await findElements.call(this, contextEls[0], locator)
1513 assertElementExists(el, locator)
1514 el = el[0]
1515 } else {
1516 el = await this._locateElement(locator)
1517 assertElementExists(el, locator)
1518 }
1519
1520 // Use manual mouse.move instead of .hover() so the offset can be added to the coordinates
1521 const { x, y } = await clickablePoint(el)
1522 await this.page.mouse.move(x + offsetX, y + offsetY)
1523 return this._waitForAction()
1524 }
1525
1526 /**
1527 * {{> focus }}

Callers

nothing calls this directly

Calls 5

_locateMethod · 0.95
_locateElementMethod · 0.95
_waitForActionMethod · 0.95
clickablePointFunction · 0.85
assertElementExistsFunction · 0.70

Tested by

no test coverage detected