← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #250815]: Drag and drop not working with java

 

Question #250815 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/250815

    Status: Needs information => Open

snick3rs gave more information on the question:
I am using Windows 8.1 with Java 7, Sikuli 1.0.1 and Eclipse. 
I defined Patterns in my class TestClass which i use in the try-block. Also i use App.open(); to open Firefox. Do i have to use App.focus(); ?

My script looks like this:

package sikuliTest;
import org.sikuli.script.*;
public class TestClass {	
	public static void main(String[] args) {		
		String imagePath = "C:/myFiles/Testing/Sikuli-IDE-1.0.1-Win32/images/";				
		Pattern thumbnail = new Pattern(imagePath + "thumbnail_001.png").similar((float) 0.7);
		Pattern placeholder = new Pattern(imagePath + "cups_placeholder.png").similar((float) 0.7);
		Screen s = new Screen();
		try {
			App.open("C:/Program Files/Mozilla Firefox/firefox.exe");
			s.exists(firefox);
			s.click(addressBar);
			s.type(null, Key.CTRL + "a");
			s.type(null, "www.urlToTest.tld");
			s.type(null, Key.ENTER);
			s.exists(ftk_logo);
			s.hover(ftk_hover_menue);
			s.exists(ftk_menue);
			s.click(ftk_cups);
			s.exists(ftk_cups_header);
			for(int i = 0; i < 9; i++) {
				s.click(scrollBar);
			}
 			s.exists(ftk_cups_overview);
			s.click(ftk_cup);
			s.exists(ftk_cup_menue);
			s.click(ftk_cup_start);
			s.exists(ftk_editor);
			s.wait((double) 6.0);
			 s.click(ftk_cup_upload);
			s.exists(fileBrowser);
			s.click(selectPicture);
			s.type(null, "2126.jpg");
			s.type(null, Key.ENTER);
			s.exists(thumbnail);
			s.wait((double) 2.0);
 			/*
			s.hover(thumbnail);
			s.mouseDown(Button.LEFT);
			s.wait((double) 1.0);
			s.mouseMove(placeholder);
			s.wait((double) 1.0);
			s.mouseUp();
			*/
			s.dragDrop(thumbnail, placeholder);
		}
		catch(FindFailed e) {
			e.printStackTrace();
		}
		
	}
	
}

Thanks for your help.

Kind regards,
Mat

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.