← Back to team overview

sikuli-driver team mailing list archive

[Bug 1262394] Re: Java dragDrop not working

 

--- Usage in Netbeans not as recommended (nothing to do with the problem)
It is recommended, that you do not move around copies of the Sikuli stuff. In your Netbeans project, you should use references to the sikuli jar, that resides in the setup folder.
This would eliminate the error message at the beginning, since the libs folder will be permanent after the first run.
In your case the dist folder is rebuilt from time to time and hence the libs folder has to be created newly and the libs exported from the jar.

-- Region  or Screen does not matter
all mouse, keyboard, search, ... functions are Region functions and inherited by Screen objects (Screen extends Region).
furthermore all preliminaries with a click, hover or other high level mouse actions finally result in a point on a physical screen, that is used by the respective series of mouse functions processed by the Java AWT Robot deep down internally.

-- does not work on Finder windows
I made this test on my OSX 10.7.5 and had no problem moving the window 500 to the right:
		App.focus("Finder");
		s.wait(1f);
		s.click(new Location(200,50));
		s.dragDrop(s.atMouse(), s.atMouse().right(500));

--- you might try:
    Screen s = new Screen();
     App.focus("BattleNations");
     App.focusedWindow().click(); // should click the centre of the window
     s.wait(0.,5)
     s.mouseDown(Button.LEFT);
     s.wait(0.5);
     s.hover(s.atMouse().above(100));
     s.mouseUp();

might be that your GUI interprets the mouseDown() immediately after the
click as part of a doubleClick.

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1262394

Title:
  Java dragDrop not working

Status in Sikuli:
  New

Bug description:
  Sikuli version: 1.0.1 (released 2013-08-12)
  Operative System: Mac OS X 10.7.5 (64bit)

  Hi, i have developed an automatic farming tool for a game named
  "Battle Nations". I have been using the Sikuli IDE, but recently, i
  have switched to Java, because I am a Java developer, and I wanted to
  add more complexity to my project.

  The problem is that the dragDrop function is not working, within the BattleNations window and MORE IMPORTANTLY within any Finder window.
  I tried two different approaches to achieve the drag n'drop:

  1) Using dragDrop (the click is used to ensure the focus on the
  window).

       Screen theScreen = new Screen();
       theScreen.wait(3.5);
       theScreen.click(theScreen.getCenter());
       theScreen.dragDrop(theScreen.getCenter(), theScreen.getCenter().offset(0, -100));

  2) Using mouse events

       theScreen.wait(3.5);
       theScreen.click(theScreen.getCenter());
       theScreen.mouseDown(Button.LEFT);
       theScreen.wait(0.5);
       theScreen.hover(theScreen.getCenter().offset(0, -100));
       theScreen.wait(0.5);
       theScreen.mouseUp(Button.LEFT);

  Both approaches work on any window (browsers, NetBeans itself) without
  any problem. But when it comes to my BattleNations window, or the a
  Finder window, the drag is not performed: the mose moves correctly
  from a location to the other. But nothing changes in the user
  interface (as if the mouse is not pressed anymore).

  The funny thing is that the dragDrop works perfectly using the Sikuli IDE, even with BattleNations!
  Can someone help?

  I also read the bug report at 
  https://bugs.launchpad.net/sikuli/+bug/886632
  but it did not solve my problem.

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1262394/+subscriptions


References