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

Method dragSlider

lib/helper/Playwright.js:2873–2889  ·  view source on GitHub ↗

* {{> dragSlider }} *

(locator, offsetX = 0)

Source from the content-addressed store, hash-verified

2871 *
2872 */
2873 async dragSlider(locator, offsetX = 0) {
2874 const src = await this._locateElement(locator)
2875 assertElementExists(src, locator, 'Slider Element')
2876
2877 // Note: Using clickablePoint private api because the .BoundingBox does not take into account iframe offsets!
2878 const sliderSource = await clickablePoint(src)
2879
2880 // Drag start point
2881 await this.page.mouse.move(sliderSource.x, sliderSource.y, { steps: 5 })
2882 await this.page.mouse.down()
2883
2884 // Drag destination
2885 await this.page.mouse.move(sliderSource.x + offsetX, sliderSource.y, { steps: 5 })
2886 await this.page.mouse.up()
2887
2888 return this._waitForAction()
2889 }
2890
2891 /**
2892 * {{> grabAttributeFrom }}

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected