MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / dragAndDrop

Method dragAndDrop

javascript/selenium-webdriver/lib/input.js:938–952  ·  view source on GitHub ↗

* Configures a drag-and-drop action consisting of the following steps: * * 1. Move to the center of the `from` element (element to be dragged). * 2. Press the left mouse button. * 3. If the `to` target is a plain ./webdriver.WebElement WebElement, * move the mouse to its

(from, to)

Source from the content-addressed store, hash-verified

936 * @return {!Actions} a self reference.
937 */
938 dragAndDrop(from, to) {
939 // Do not require up top to avoid a cycle that breaks static analysis.
940 const { WebElement } = require('./webdriver')
941 if (!(to instanceof WebElement) && (!to || typeof to.x !== 'number' || typeof to.y !== 'number')) {
942 throw new InvalidArgumentError('Invalid drag target; must specify a WebElement or {x, y} offset')
943 }
944
945 this.move({ origin: from }).press()
946 if (to instanceof WebElement) {
947 this.move({ origin: to })
948 } else {
949 this.move({ x: to.x, y: to.y, origin: Origin.POINTER })
950 }
951 return this.release()
952 }
953
954 /**
955 * Releases all keys, pointers, and clears internal state.

Callers 3

actions_test.jsFile · 0.45
input_test.jsFile · 0.45
input_test.jsFile · 0.45

Calls 3

moveMethod · 0.95
releaseMethod · 0.95
pressMethod · 0.45

Tested by

no test coverage detected