← Back to team overview

sikuli-driver team mailing list archive

[Question #151830]: Unable to find a file from the list of files

 

New question #151830 on Sikuli:
https://answers.launchpad.net/sikuli/+question/151830

Scenario:
------------
1. I am using android emulator. There are some files (see the filelist.png) stored. 
2. I want to select a specific file (example:210S3_4@CRD in the attached filelist.png)
3. Click for 5 seconds, I will get an list of options like delete
4. I want to click delete.

Issue:
----------
I am getting only the first filename in the list in findall().

My code:
------------
try{

	Iterator<Match> matches1 = s.findAll("D:/test/mobile/android/imgs/filelist.png");

	while (matches1.hasNext()){

		Match next = matches1.next();
		String value = next.text();
		if (value == null || value.trim().length() == 0) 
			break;

		System.out.println("value: " + value);

                     //sometimes the text is not coming correctly, i written similarity function to check
	    if (StringOperations.getSimilarity("210S3_4@CRD", value) > 60){

		System.out.println("Match found");

		Region r = s.getRegionFromPSRM(next);

		Thread.sleep(1000);	


		r.mouseDown(0);
		Thread.sleep(4000);
		r.mouseUp(0);

		Pattern deleteButtonP = new Pattern("D:/test/mobile/android/imgs/DeleteOption.png");
		Thread.sleep(1000);	
		s.click(deleteButtonP, 0);
	    }
	}
	

} catch (FindFailed e) {
	// TODO Auto-generated catch block
	e.printStackTrace();

} catch (Exception e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}


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