Getting an Exception System.ComponentModel.Win32Exception : The system cannot find the file specified in Sikuli C#

I am getting an exception System.ComponentModel.Win32Exception : The system cannot find the file specified when i employ Sikuli in C# using selenium.

I have referred to other posts in Stack but i have not not got a solution for that. I am also running VS 2017 in administrator mode I have latest copy of Rest-Api Jar in /Debug folder.

Below is my code

using System;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium.Support.UI;
using Sikuli4Net.sikuli_REST;
using Sikuli4Net.sikuli_UTIL;
using SikuliModule;

namespace DownloadFile
public class Download
    private IWebDriver driver;
    private APILauncher launcher;

    public void setup()
        driver = new FirefoxDriver();
        launcher = new APILauncher(true);

    public void TestMethod1()
        new WebDriverWait(driver, TimeSpan.FromSeconds(60)).Until(ExpectedConditions.ElementExists((By.XPath("//span[contains(text(),'Free Java Download')]")))).Click();
        new WebDriverWait(driver, TimeSpan.FromSeconds(60)).Until(ExpectedConditions.ElementExists((By.XPath("//span[contains(text(),'Agree and Start Free Download')]")))).Click();
        Screen screen = new Screen();
        Pattern Click_Save = new Pattern("C:/Selenium Files/Save.jpg");
        screen.Wait(Click_Save, 500);



1 answer

  • answered 2018-04-17 05:11 Ramdeep Singh

    Update your path of .jpg file in below line of code:

        Pattern Click_Save = new Pattern("C:\\Selenium Files\\Save.jpg");

    Rest of the code seems fine.