← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #160030]: [HowTo] sort matches returned from findAll()/Finder.find()

 

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

hanumantha Katreddy posted a new comment:
hi Raiman,
I am using SikuliX for past 3 months in Java. I come across a similar problem. My application has a screen, where text fields of similar shape and size are spread in tabular format. i want to input text in to a particular text field based on its sort order either row wise or column wise. Can you explain how to handle in java?
Below is my code...


	public void setText(String elementpath,int clickonnthfind) throws Exception, FindFailed, InterruptedException {
		Region reg = getRegion(rootpath+"Common//TableScreen");
		Pattern pat = new Pattern(elementpath); //text field image pattern
		Iterator <Match> it = reg.findAll(pat); //findAll(textfields));
		
		int nth=1;				
		while(it.hasNext()){
			it.next().click();
			it.next().type(String.valueOf(nth)); //this is randomly picking up text fields and setting text 
			System.out.println("clicked at"+nth);
			Thread.sleep(3000);
			nth++;
			/*if(nth==clickonnthfind){
				it.next().click();
				System.out.println("clicked at"+nth);
				Thread.sleep(3000); 
			}*/	
		}
	}

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.