Reputation: 5383
I am using Selenium 3.14 and ChromeDriver 2.42 with Chrome 69.0. I was always using this code to drag and drop, which worked until recently, when tests started failing:
$driver->action()->clickAndHold()->moveByOffset(100, 0)->release()->perform();
After some Chrome update, it just stopped dragging. I also tried dragAndDropBy()
function, with no luck. (dragAndDrop()
is not an option because I need to move inside one element).
Upvotes: 0
Views: 385
Reputation: 5383
After hours of experimenting I was able to narrow the issue down to this weird thing, when using moveByOffset with bigger number, like 100
in my example fails, it just weirdly bounces in place. But when I tried to move it only by couple of px, it worked.
This is the code I ended up with:
$driver->action()->clickAndHold()->perform();
for($i = 0; $i < 10; $i++){
//moving this 10 times by 10 px instead of once by 100px
$driver->action()->moveByOffset(10, 0)->perform();
}
sleep(1);
$driver->action()->release()->perform();
I just want to share this, if somebody encountered similar issue.
Upvotes: 2