hi Team,
i want to select some data points by scrubbing i.e hold one item and sliding (while holding) over several data points
i tried using the drag and drop like below
The logic i have tried to achieve here is that click the first item and move the cursor till the last targeted item to be selected but problem is, it is not selecting the items but seems like moved the screen/swiped the screen a bit.
this is not actually dragging an item and dropping that will not happen but i am just trying to simulate the behaviour of selecting the items.
WebElement source = getElement(sourceLocator);
WebElement target = getElement(targetLocator);
Point sourcePoint = getCenter(source);
Point targetPoint = getCenter(target);
PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, “finger”);
Sequence dragNDrop = new Sequence(finger, 1);
dragNDrop.addAction(finger.createPointerMove(Duration.ofMillis(0),
PointerInput.Origin.viewport(), sourcePoint.x, sourcePoint.y));
dragNDrop.addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg()));
dragNDrop.addAction(finger.createPointerMove(Duration.ofMillis(700),
PointerInput.Origin.viewport(),targetPoint.x, targetPoint.y));
dragNDrop.addAction(finger.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));
driver.perform(Arrays.asList(dragNDrop));
Any suggestion would be appreciated thank you!
For example - selecting and highlighting all lines in a page by dragging over the lines
click+drag