Following drag and drop code need to be run in chrome headless, which wirte by using Java robot.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Following drag and drop code need to be run in chrome headless, which wirte by using Java robot.

dev.perera

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

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/1f07bfe2-7b6d-4fa6-ac54-8bc3aec50113%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.