← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #227366]: java.lang.OutOfMemoryError: Java heap space-Eclipse

 

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

    Status: Answered => Open

Bindu is still having a problem:
Hi Raiman,

Please find the code below for ClickImage that I created. I am using
selenium and sikuli in my scripts, Can you please take a look at the
funciton and let me know if there are any sikuli objects being blocked
from Garbage Collection:

Thanks a lot for your time and guidance

public boolean ClickImage(String imageName, String FilePath,boolean testStatus) throws IOException {
      if (testStatus) {
		Screen s = new Screen();
		String result;
		result = "";
		int Flag = 0;
		int Moved = 0;
		int ScrollTop = 0;
		Long OldScroll = (long) 1;
		Long newScroll = (long) 0;
		String iMPath=System.getProperty("user.dir")+ "//src//com//qtpselenium//images//" + imageName+ ".png";
		JavascriptExecutor js = (JavascriptExecutor) driver;
		try {
		    do {
			if (s.exists(iMPath) != null) {															
			 s.click(iMPath);			
			 result = "Clicked on " + imageName + " Successfully";
			 Flag = 1;
		 	 break;
			} else if (OldScroll > newScroll) {//Scroll down the browser scroll bar if the object is not found
			 OldScroll=(Long) getScrollValue(js);					
			 js.executeScript("javascript:window.scrollBy(0,30)"); 					
			newScroll = (Long) getScrollValue(js);
			ScrollTop = ScrollTop + 30;
			Moved = 1;
					
			} else {
			  Flag = 1;
			  result = imageName + "Object Not Found";
			  APP_LOGS.debug(result);
			  //capturescreenshot(FilePath);
			  js=null;
			  s=null;						
			  result=null;
			  return false;

			}
		} while (Flag != 1);

		if (Moved == 1) {// Code to Move the Scroll bar back to the
		  waitTime(2);		// initial position
		  js.executeScript("javascript:window.scrollTo(0,0)");
		}

	} catch (FindFailed e) {
	   e.printStackTrace();
	   result = "Failed to click on " + imageName;
	  APP_LOGS.debug(result);
	  //capturescreenshot(FilePath);
	  js=null;
	  s=null;			
	  result=null;
	  return false;
	}
		
	APP_LOGS.debug(result);
	js=null;
	s = null;
	result=null;					
	return true;
          } else
             return false;
}

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