← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #295298]: How to add Image file in jar file

 

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

    Status: Solved => Open

Reshma Thakur is still having a problem:
Hi Raiman,

One question, so i added your code in my code and it ran till entering
id, password and clicking submit.

Now, I have few pictures which need target offset property to specify
where i want to click, so i did it like this:

	  String Austinclk="Austin.PNG";
	  String Scrollbar1="ScrollBar.PNG";
	  
	  Pattern Austin=new Pattern(Austinclk).targetOffset(-29, 0);
		
	  Pattern Scrollbar=new Pattern(Scrollbar1);
	  
when i run this code it gives below error message:

error] Image: could not be loaded: jar:file:/C:/Users/Reshma/Desktop/TPIM.jar!/imgs/Austin.PNG
[error] Image: Image not valid, but TextSearch is switched off!
[error] Image: could not be loaded: jar:file:/C:/Users/Reshma/Desktop/TPIM.jar!/imgs/ScrollBar.PNG
[error] Image: Image not valid, but TextSearch is switched off!
[error] Image: could not be loaded: jar:file:/C:/Users/Reshma/Desktop/TPIM.jar!/imgs/ScrollBar.PNG
[error] Image: Image not valid, but TextSearch is switched off!


Also, after clicking submit button, I need to click on Navigate button which comes after 10sec of clicking submit button, so when i do it directly from eclipse it works but using jar file it doesn't wait for a image to come in screen. 

	  String clazz = "testAPI.Test";
	  String imgFolder = "/imgs";

	  String inJarFolder = clazz + imgFolder;
	  ImagePath.add(inJarFolder);
	  String Navigate="NavigateBtn.PNG";

        s.click(s.wait(Navigate, 20));

it gives the below error message:

[error] Image: could not be loaded: jar:file:/C:/Users/Reshma/Desktop/TPIM.jar!/imgs/NavigateBtn.PNG
[error] Image: Image not valid, but TextSearch is switched off!
can't find navigate
[error] Image: could not be loaded: jar:file:/C:/Users/Reshma/Desktop/TPIM.jar!/imgs/NavigateBtn.PNG
[error] Image: Image not valid, but TextSearch is switched off!
Exception in thread "main" FindFailed: Region: doFind: Image not loadable: NavigateBtn.PNG
  Line 2535, in file Region.java

        at org.sikuli.script.Region.wait(Region.java:2535)
        at testAPI.Test.main(Test.java:163)


I am able to come so far because of your help, please suggest something to submit my project to client. Thanks a lot in Advance!

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