MCPcopy
hub / github.com/codeceptjs/CodeceptJS / dragSlider

Method dragSlider

lib/helper/Puppeteer.js:2158–2174  ·  view source on GitHub ↗

* {{> dragSlider }}

(locator, offsetX = 0)

Source from the content-addressed store, hash-verified

2156 * {{> dragSlider }}
2157 */
2158 async dragSlider(locator, offsetX = 0) {
2159 const src = await this._locate(locator)
2160 assertElementExists(src, locator, 'Slider Element')
2161
2162 // Note: Using public api .getClickablePoint because the .BoundingBox does not take into account iframe offsets
2163 const sliderSource = await getClickablePoint(src[0])
2164
2165 // Drag start point
2166 await this.page.mouse.move(sliderSource.x, sliderSource.y, { steps: 5 })
2167 await this.page.mouse.down()
2168
2169 // Drag destination
2170 await this.page.mouse.move(sliderSource.x + offsetX, sliderSource.y, { steps: 5 })
2171 await this.page.mouse.up()
2172
2173 await this._waitForAction()
2174 }
2175
2176 /**
2177 * {{> grabAttributeFromAll }}

Calls 4

_locateMethod · 0.95
_waitForActionMethod · 0.95
getClickablePointFunction · 0.85
assertElementExistsFunction · 0.70

Tested by

no test coverage detected