* {{> moveCursorTo }}
(locator, xOffset, yOffset)
| 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 }} |
no test coverage detected