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

Method moveCursorTo

lib/helper/WebDriver.js:1955–1978  ·  view source on GitHub ↗

* {{> moveCursorTo }}

(locator, xOffset, yOffset)

Source from the content-addressed store, hash-verified

1953 * {{> moveCursorTo }}
1954 */
1955 async moveCursorTo(locator, xOffset, yOffset) {
1956 let context = null
1957 if (typeof xOffset !== 'number' && xOffset !== undefined) {
1958 context = xOffset
1959 xOffset = undefined
1960 }
1961
1962 let res
1963 if (context) {
1964 const contextRes = await this._locate(withStrictLocator(context), true)
1965 assertElementExists(contextRes, context, 'Context element')
1966 res = await contextRes[0].$$(withStrictLocator(locator))
1967 assertElementExists(res, locator)
1968 } else {
1969 res = await this._locate(withStrictLocator(locator), true)
1970 assertElementExists(res, locator)
1971 }
1972 const elem = usingFirstElement(res)
1973 try {
1974 await elem.moveTo({ xOffset, yOffset })
1975 } catch (e) {
1976 output.debug(e.message)
1977 }
1978 }
1979
1980 /**
1981 * {{> saveElementScreenshot }}

Callers 1

dragSliderMethod · 0.95

Calls 6

_locateMethod · 0.95
withStrictLocatorFunction · 0.85
usingFirstElementFunction · 0.85
$$Method · 0.80
debugMethod · 0.80
assertElementExistsFunction · 0.70

Tested by

no test coverage detected