Hi All,
Following drag and drop code need to be run in chrome headless, which wirte by using Java robot class.
Robot dragAndDrop = new Robot();
dragAndDrop.mouseMove(290, 430); //actual pixel location of the draggable element
dragAndDrop.mousePress(InputEvent.BUTTON1_MASK);// click mouse left button and hold
sleep(3000);
dragAndDrop.mouseMove(50, 280);
dragAndDrop.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);//release mouse left button
sleep(3000);
dragAndDrop.mousePress(InputEvent.BUTTON1_MASK);//no idea about this line and below, but without those drag and drop won’t work
sleep(3000);
((HasInputDevices) driver).getKeyboard().pressKey(Keys.ENTER);
dragAndDrop.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
sleep(3000);
Above code wont running in headless mode, since its try to click based on X,Y co-ordinate.
Also I tried with Java action class, but no luck
I have tried most of the option and nothing work except the above code.
I have two options as below.
1. Execute about robot scripts in headless mode by using XVfb. I don’t know about this, can anyone send about more details on this?
2. Change scripts by using action class or giving x,y coordinate by element reference, that way I might able to run in headless mode.
...................
Thanks
Dev Chaminda Perera