← 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

Reshma Thakur gave more information on the question:
Yes I am using sikulix 1.1.0.

My code is not able to recognize the source folder. When i debug it says
source not fond( I have made res folder as source folder)

the folder structure is still same (mentioned in my question above):

Here's my code:

package TryImages;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.sikuli.script.*;
import org.sikuli.script.Screen;

import java.io.IOException;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;

public class TryImages {


	static BufferedImage img;
	static BufferedImage img3;
	
	
	static String img1= "/imgs/Search.png";
	static String img2 ="/imgs/Enter.png";
		
	public static void main(String[] args) throws InterruptedException {
		
		Screen screen= new Screen();
		System.setProperty("webdriver.firefox.bin","C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");   //"C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");		
		
		WebDriver driver = new FirefoxDriver();		
		
		driver.manage().window().maximize();
				
			System.out.println("checking file 1 ");		
		driver.get("https://www.google.com/";);
		
		try {
			System.out.println("inside try");
			screen.type(ImageIO.read(TryImages.class.getResource(img2)),"H");
			System.out.println("After Tyr");
		} catch (FindFailed e2) {
			System.out.println("find Fail");
			// TODO Auto-generated catch block
			e2.printStackTrace();
		} catch (IOException e2) {
			System.out.println("inside Fail");
			// TODO Auto-generated catch block
			e2.printStackTrace();
		}

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