Overview

Sikuli Integrator is an open source framework which gives you the ability to use Sikuli in C# code.

Requirements

Add JAVA_HOME environment variable with value = path to installed JRE bin folder.

Installation

You can get a StartUp project,  or can create a new project by follow next steps:

  1. Create new project in Visual Studio 2012
  2. In the “Solution Explorer” – right-click on the solution
  3. Choose  “Manage NuGet Packages for Solution…”
  4. Search for “SikuliIntegrator” and install it
  5. After the installation “JSikuliModule.jar” should be part of your solution, together with some additional files
  6. Right-Click on “JSikuliModule.jar” and choose “Properties”
  7. Set “Copy to Output Directory” property to “Copy always”

All set!

If you want to use latest version, check it out from SVN repositoryhttps://sikuli-integrator.googlecode.com/svn/trunk/SikuliModule

Step 6 and 7 should be applied to all image patterns.

How to use it?

Sikuli Integrator currently support some of Sikuli features which can be called:

SikuliAction.[ACTION](ARGUMENTS);
  • Exists

if (SikuliAction.Exists(pattern).IsEmpty)
{
      Console.WriteLine("Nope! It's gone...");
}
else
{
      Console.WriteLine("Yep! It's there...");
}

Where pattern is path to image.

  • Click

SikuliAction.Click(pattern);
  • Double Click

SikuliAction.DoubleClick(pattern);
  • Right Click

SikuliAction.RightClick(pattern);
  • Hover

SikuliAction.Hover(pattern);
  • Wait

SikuliAction.Wait(pattern, timeout);
  • WaitVanish

SikuliAction.WaitVanish(pattern, timeout);
  • Drag And Drop

SikuliAction.DragAndDrop(fromPattern, toPattern);
  • FindAll

//There are 3 patterns on the test image
List points = SikuliAction.FindAll(findAllPattern);
if (points != null)
{
	foreach (Point point in points)
	{
		Console.WriteLine("X:" + point.X + "  Y: " + point.Y);
	}
	if (points.Count == 3)
	{
		Console.WriteLine("Yep! They are 3...");
	}
	else
	{
		Console.WriteLine("Nope! They are NOT 3, they are " + points.Count);
	}
}
else
{
	Console.WriteLine("Nope! There is a problem...");
}
Advertisements

Comments on: "How to use Sikuli in my C# coded tests?" (81)

  1. Eider said:

    Very Nice!
    it worked for me.

    • Alex said:

      Didn’t work for me ((
      Here’s stack trace:

      at SikuliModule.Commander.ConsumeResult(String output, String error) in c:\Users\atsvetkov\Dropbox\Projects\SikuliModule\SikuliModule\Commander.cs:line 93
      at SikuliModule.Commander.Execute(Command command, String mainPattern, String extraPattern, Single similarity, Int32 timeout) in c:\Users\atsvetkov\Dropbox\Projects\SikuliModule\SikuliModule\Commander.cs:line 72
      at SikuliModule.SikuliAction.Exists(String pattern) in c:\Users\atsvetkov\Dropbox\Projects\SikuliModule\SikuliModule\SikuliAction.cs:line 17
      at StartUpProject.Program.Main(String[] args) in d:\Work\Source\StartUpProject\Program.cs:line 18
      at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
      at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
      at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
      at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Threading.ThreadHelper.ThreadStart()

      • Which version of Java you use?
        Did you add JAVA_HOME in your Environment variables?

      • Alex said:

        Damn, missed part about java 1.7. The worst thing is that usage of java 1.7 is mandatory on the environment I use and I cannot downgrade it. Any ideas how to workaround it? Any alternatives for SikuliIntegrator?
        Thanks.

      • You can download and install the jre-6u35-windows-i586.exe and then refer to it from your JAVA_HOME environment. I hope this will work. Meanwhile I work on Sikuli Integrator – it has some new functions and almost all of Sikuli methods can be called from C# code. After that the next step is to update sikuli core and you will be able to use it without this dependency for java 6.
        I hope this is helpful for you!

      • Eider said:

        Hi Alex
        I have it working with JRE7. You need to ensre that you are using a JRE7 (x86). and setup your JAVA_HOME to (X86) path, like this:

        C:\Users\eider_mauricio>echo %java_home%
        C:\Program Files (x86)\Java\jre7

  2. Alex said:

    Hi guys,
    I’ve made sure I did all the steps listed above but still having the same problem.
    Current java version is
    >java -version
    java version “1.6.0_45”
    Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
    Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode)

    There’s one thing I can’t understand: why does it open FileDialog looking for this file – c:\Users\atsvetkov\Dropbox\Projects\SikuliModule\SikuliModule\SikuliAction.cs

    Maybe I should have copied SikuliModule somewhere? Domain policy which applies to my PC won’t allow to create such folder in c:\Users.

  3. Alex said:

    Ok it looked for SikuliAction because I pressed “Step Into”.

    The System exception without stack trace which I’ve posted earlier is: “{“###For input string: \”0,95\”\r\n###FAILURE\r\n”}”

    • Hi Alex,

      1. You should have a file called SikuliOutputLog.txt on your drive C. Could you show use what is the content of this file.
      2. Do you start your Visual Studio as Administrator?
      3. Could you try to get the latest source code of Sikuli Integrator from here(SVN):
      https://sikuli-integrator.googlecode.com/svn/trunk/SikuliModule
      There is a UnitTest project where you can see how to develop your automation test cases with Sikuli and examples of all supported features. They are almost all possible.

      • Alex said:

        1. Yeap, here it is: “-jar “D:\Source\StartUpProject\bin\Debug\JSikuliModule.jar” d:\Source\StartUpProject\bin\Debug\img\pattern.png “EXISTS” 0,95 10000″
        I’ve made sure that img\pattern.png is there.
        2. Yes, as Administrator.
        3. I will do. I actually updated dependency from NuGet, I’ve seen that there’s a newer version.

  4. Alex said:

    Ok. So I managed to download SikuliModule and ran tests.
    4 tests out of 18 failed:
    TestFindAllIntoRegion
    TestExistsDefault
    TestExistsWithSimilarity90AndTimeout5
    TestFindAllWithSimilarity90AndTimeout5

    The fact that 14 tests passed gives hope that something is working and the problem is not with java or VS.

    • Eider said:

      Hi Alex we are developing some improvements. Congratulations now you are using the int3grator. Can you tell us what JRE version do you have?

      • Alex said:

        Wrote it above it’s 32bit jre:
        >java -version
        java version “1.6.0_45″
        Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
        Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode)

        Was trying to debug unit tests for the SikuliModule and stopped on the Commander.cs line 88. Look at the content of the error variable on the breakpoint – maybe it will be helpful:

        “”Exception in thread \”main\” java.lang.UnsatisfiedLinkError: C:\\Users\\Oleksandr_Shavrov\\AppData\\Local\\Temp\\tmplib\\VisionProxy.dll: Can’t find dependent libraries\r\n\tat java.lang.ClassLoader$NativeLibrary.load(Native Method)\r\n\tat java.lang.ClassLoader.loadLibrary0(Unknown Source)\r\n\tat java.lang.ClassLoader.loadLibrary(Unknown Source)\r\n\tat java.lang.Runtime.load0(Unknown Source)\r\n\tat java.lang.System.load(Unknown Source)\r\n\tat com.wapmx.nativeutils.jniloader.NativeLoader.loadLibrary(NativeLoader.java:44)\r\n\tat org.sikuli.script.Finder.(Finder.java:33)\r\n\tat org.sikuli.script.Region.doFind(Region.java:1029)\r\n\tat org.sikuli.script.Region$RepeatableFind.run(Region.java:1232)\r\n\tat org.sikuli.script.Region$Repeatable.repeat(Region.java:1203)\r\n\tat org.sikuli.script.Region.exists(Region.java:538)\r\n\tat com.sikuliintegrator.Operation.GetPoint(Operation.java:31)\r\n\tat com.sikuliintegrator.Pointer.main(Pointer.java:105)\r\n””

  5. Austin said:

    Could you provide more examples here?

    What is the pattern parameter. A link to a image perhaps? etc?

    • Thank you for your interest in SikuliIntegrator.

      You can find examples for all supported features in this solution:
      https://sikuli-integrator.googlecode.com/svn/trunk/SikuliModule

      Just get it with your SVN client. In the project UnitTests you can find all the examples.

      Yes, you are right. pattern is the attribute which represent the path to the image resource you want to search for. My proposal i to use image folder in your solution and to put all your images there. After that you can refer them using relative path. You can see this in the UnitTests project I mentioned before.

      I will appreciate your feedback!

  6. Sobi said:

    I am seeing

    Error: Unable to access jarfile JSikuliModule.jar inside the temp folder

    When running unit test on .NET 2012.
    I have set full permission and still seeing this issue,

    Please advise

    Thanks in advance.

    • Did you install all the requirements? Find them in Requirements section of the post.

      • Sobi said:

        Thanks for your prompt reply,

        I have Java version(s): 6.0, 7.0 , .Net 4.5.5 & NuGet

        It looks like I am having an issue where file cannot be written from specif location
        //

        Error: Unable to access jarfile C:\Users\sobi.vasanthakumaran\AppData\Local\Temp\4hgqfc23.oa1\Regression_Tests\assembly\dl3\742d6a57\1d3d2f3c_79c3ce01\JSikuliModule.jar

        //

        I have set all the permission. Also I noticed that JSikuliModule.jar cannot be added as ref but had to add it separately.

        Thanks

      • Did you manage to run the tests?

  7. sobi said:

    I can get the web browser but fails to read the file due to permission.

    Thx

  8. Sobi said:

    Yes I ran it as admin.

    Only when I run it as admin I get this message

    //
    Error: Unable to access jarfile C:\Users\sobi.vasanthakumaran\AppData\Local\Temp\4hgqfc23.oa1\Regression_Tests\assembly\dl3\742d6a57\1d3d2f3c_79c3ce01\JSikuliModule.jar
    //

    If I run run normally I get this message

    //
    Access to the path ‘C:\SikuliOutputLog.txt’ is denied.
    //

    But I made sure the the folder and file have full permission

    Thx

    • Could you check files “C:\SikuliExceptionLog.txt” and “C:\SikuliOutputLog.txt” if there is info which can helps you!

      Also could you try to run your project from different folder because there is a possibility C:\Users\sobi.vasanthakumaran\AppData\Local\Temp\4hgqfc23.oa1\Regression_Tests\assembly\dl3\742d6a57\1d3d2f3c_79c3ce01 to be too long! Try it just in case!

      • Sobi said:

        I moved my project to c:\ and was getting the same error
        //
        Access to the path ‘C:\SikuliOutputLog.txt’ is denied.
        //

        Also I cannot find “SikuliExceptionLog.txt” file

      • Run Visual Studio as Administrator again

  9. Sobi said:

    I ran it as admin and created a log and here below is the output. Also I am still seeing the error message access file.

    SikuliOutputLog file content:

    -jar “C:\Users\sobi.vasanthakumaran\AppData\Local\Temp\nkyhcqtr.pgi\Regression_Tests\assembly\dl3\bee52342\1d3d2f3c_79c3ce01\JSikuliModule.jar” “C:\forums.png” “CLICK” 0.95 10000

  10. Sobi said:

    It looks like it is looking for this file in this folder all the time but does not exist. I treid adding the file but then another folder is created where the file does not exist. I think i will give up until more docs are available for sikuli.

    Error: Unable to access jarfile C:\Users\sobi.vasanthakumaran\AppData\Local\Temp\cr0jzdiz.qpe\Regression_Tests\assembly\dl3\32a2b72e\1d3d2f3c_79c3ce01\JSikuliModule.jar

    Thx

  11. Mikhail said:

    Hello Angel,
    Could you help me?
    I did all as in the instruction. Click, Wait, FindAll and ect. work good. But DoubleClick doesn’t work at all. I saw next error while debug:

    LICK” 0.95 10
    Exception in thread “main” java.lang.UnsatisfiedLinkError: C:\Users\Mtanaev\AppD
    ata\Local\Temp\2\tmplib\Win32Util.dll: Can’t load IA 32-bit .dll on a AMD 64-bit
    platform
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(Unknown Source)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at com.wapmx.nativeutils.jniloader.NativeLoader.loadLibrary(NativeLoader
    .java:44)
    at org.sikuli.script.Win32Util.(Win32Util.java:19)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.sikuli.script.Env.getOSUtil(Env.java:91)
    at org.sikuli.script.ScreenHighlighter.init(ScreenHighlighter.java:180)
    at org.sikuli.script.ScreenHighlighter.(ScreenHighlighter.java:293
    )
    at org.sikuli.script.Screen.initBounds(Screen.java:105)
    at org.sikuli.script.Screen.(Screen.java:117)
    at com.sikuliintegrator.Operation.DoubleClick(Operation.java:95)
    at com.sikuliintegrator.Pointer.main(Pointer.java:113)

    I use Windows Server 2014 64x

    Best Regards,
    Mikhail

    • Hi Mikhail,

      It seems that the incorrect command is used: LICK” 0.95 10

      Could you check the trace file in your drive C?

      • Hi Mikhail,
        There was a bug in the SikuliModule. Please check it out and everything should be OK now!

        The project is located here: https://sikuli-integrator.googlecode.com/svn/trunk/SikuliModule

        You can use UnitTests as examples of how to use sikuli integrator from your C# code.

      • Mikhail said:

        Hello Angel,
        Sorry for delay (I have been on vacation).
        I checked latest version. And I have the same problem, “Click” works perfect, but “DoubleClick” doesn’t work. I checked on several PC with different OS and JRE (1.6 and 1.7).

        SikuliExeptionLog:
        Exception in thread “main” java.lang.UnsatisfiedLinkError: C:\Users\Mtanaev\AppData\Local\Temp\tmplib\VisionProxy.dll: Can’t find dependent libraries
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary1(Unknown Source)
        at java.lang.ClassLoader.loadLibrary0(Unknown Source)
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.load0(Unknown Source)
        at java.lang.System.load(Unknown Source)
        at com.wapmx.nativeutils.jniloader.NativeLoader.loadLibrary(NativeLoader.java:44)
        at org.sikuli.script.Finder.(Finder.java:33)
        at org.sikuli.script.Region.doFind(Region.java:1029)
        at org.sikuli.script.Region$RepeatableFind.run(Region.java:1232)
        at org.sikuli.script.Region$Repeatable.repeat(Region.java:1203)
        at org.sikuli.script.Region.exists(Region.java:538)
        at com.sikuliintegrator.Operation.DoubleClick(Operation.java:97)
        at com.sikuliintegrator.Pointer.main(Pointer.java:113)

        SikuliOutputLog:
        -jar “C:\Portal\OS33.QA.AutoTest\NEW Sikuli\TestResults\mtanaev_WKS29 2014-01-09 10_31_23\Out\JSikuliModule.jar” “C:\Portal\OS33.QA.AutoTest\NEW Sikuli\TestResults\mtanaev_WKS29 2014-01-09 10_31_23\Out\testFolder.png” “DOUBLE_CLICK” 0.95 10

        Could you suggest something?

        Thanks in advance,
        Mikhail

      • Mady said:

        Hi, I also met the exception: UnsatisfiedLinkError:…VisionProxy.dll: Can’t find dependent libraries. this error only occurs when I try to perform DoubleClick or RightClick.

        Anything can do to make help?

      • Eider said:

        @Mady @Mikhail @Alex To deal with UnsatisfiedLinkError:

        Try Copying the following DLLs into your (%JAVA_HOME%/bin) directory

        cv210.dll
        cvaux210.dll
        cxcore210.dll
        highgui210.dll
        JIntellitype.dll
        ml210.dll
        VDictProxy.dll
        VisionProxy.dll
        Win32Util.dll

        Tell Us,

        ¿What OS architecture do you jave x86 or x64 ?
        ¿What JRE architecture do you have x86 or x64?

  12. andineupert said:

    Hey guys, I get the same error as Alex in “ConsumeResult” / “Execute” when running “SikuliAction.Click(pattern);”
    OutputLog says:
    -jar “D:\Files\Repositories\LeapConnector\src\LeapConnector\LeapConnectorTester\bin\Debug\JSikuliModule.jar” “D:\Files\Repositories\LeapConnector\src\LeapConnector\LeapConnectorTester\bin\Debug\res\pattern.png” “CLICK” 0,95 10000
    I’ve installed Java 6 Update 45 and set JAVA_HOME=C:\Program Files (x86)\Java\jre6\bin and I’m starting Visual Studio in Admin mode

    Any suggestions how to solve this? Thanks!

  13. andineupert said:

    Stacktrace:

    bei SikuliModule.Commander.ConsumeResult(String output, String error) in c:\Users\Angel\Dropbox\Projects\SikuliModule\SikuliModule\Commander.cs:Zeile 103.
    bei SikuliModule.Commander.Execute(Command command, String mainPattern, String extraPattern, Single similarity, Int32 timeout) in c:\Users\Angel\Dropbox\Projects\SikuliModule\SikuliModule\Commander.cs:Zeile 73.
    bei SikuliModule.SikuliAction.Click(String pattern) in c:\Users\Angel\Dropbox\Projects\SikuliModule\SikuliModule\SikuliAction.cs:Zeile 46.
    bei DBController.MainWindow.Button_Click(Object sender, RoutedEventArgs e) in d:\Files\Repositories\LeapConnector\src\LeapConnector\DBController\MainWindow.xaml.cs:Zeile 32.
    bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
    bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
    bei System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
    bei System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
    bei System.Windows.Controls.Primitives.ButtonBase.OnClick()
    bei System.Windows.Controls.Button.OnClick()
    bei System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
    bei System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
    bei System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
    bei System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
    bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
    bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
    bei System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
    bei System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
    bei System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
    bei System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
    bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
    bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
    bei System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
    bei System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
    bei System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
    bei System.Windows.Input.InputManager.ProcessStagingArea()
    bei System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
    bei System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
    bei System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
    bei System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
    bei System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
    bei MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
    bei MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
    bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
    bei MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
    bei System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
    bei MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
    bei MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
    bei System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
    bei System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
    bei System.Windows.Threading.Dispatcher.Run()
    bei System.Windows.Application.RunDispatcher(Object ignore)
    bei System.Windows.Application.RunInternal(Window window)
    bei System.Windows.Application.Run(Window window)
    bei System.Windows.Application.Run()
    bei DBController.App.Main() in d:\Files\Repositories\LeapConnector\src\LeapConnector\DBController\obj\Debug\App.g.cs:Zeile 0.
    bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
    bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    bei System.Threading.ThreadHelper.ThreadStart()

  14. Naga said:

    I am getting error in Type and Double Click.. Tried a lot to fix but no use.
    The image is getting identified in FindAll method.

    Please find the snapshot of the error
    https://drive.google.com/file/d/0B3wsTg6M3tRxWkxrc2o5WVEtWUU/edit?usp=sharing
    https://drive.google.com/file/d/0B3wsTg6M3tRxeWM3ckZtdTJRRzQ/edit?usp=sharing

    • Eider said:

      You should see Installed in your “control panel > program and features> visual C++ 2010 Redistributable Package” at x86 and x64 bits according to your java JRE runtime platform.

      If not, then download and install Redistributable Package form Microsoft site.

  15. Ellie said:

    I used SikuliIntegrator in my selenium test as I needed to automate an upload, and SikuliAction.Click(pattern) was working really well to click the browse button… until a few days ago. It just stopped working without me changing anything. I get this error now whenever a SikuliAction method is called:

    The file ‘C:\Users\u0160974\AppData\Local\Temp\sikulilibs\Microsoft.VC90.CRT\msvcm90.dll.tmp’ already exists.

    Has anyone ever seen that error?

    I tried using SikuliAction.Hover() and others but I get the same error. I also reinstalled the SikuliIntegrator via the Package Manager Console but no luck.

    Any ideas?

  16. Vaishnavi said:

    Hi.. I am using sikuli integrator in my c# tests with selenium. Click and findall methods are working fine. But SikuliAction.Type is not working for me. on trying to debug I found the below:

    BasePriority : ‘reg.BasePriority’ threw an exception of type ‘System.InvalidOperationException’

    Most of the members of the initiated process show same exception

    Any ideas on how to resolve this?

    • Francisco said:

      Hi,

      I’m having exactly that problem in my tests (type is not working, with that same message).
      Did you get it to work? If so, could you tell me how?

      Thanks

      • Vaishnavi said:

        Hi,
        I removed Command, Commander, Settings and SikuliActions files from the solution and placed latest files from SVN http://sikuli-integrator.googlecode.com/svn/trunk/SikuliModule/
        and that worked for me.

      • Francisco said:

        Hi,
        Couldn’t reply don’t know why, so i putted the thumbs up instead.
        Just to thank for the help. I actually did it with those files already updated so that doesn’t solve my problem but still thanks for the suggestion.

  17. Ajaz said:

    Hi, i have been getting the following error when executing SikuliAction.Click(@”path”);

    Test method SeleniumAutomation.SikuliTests.HandlingDesktopElementUsingSikuli threw exception:
    System.ComponentModel.Win32Exception: The system cannot find the file specified

  18. Jason Mar said:

    Hi, I have been getting the System.Exception.Error: Unable to access jarfile.

    It is looking for the JSikuliModule.jar in the Out folder of the TestResults. However, I cannot place it in the folder because it is generated every time i run a coded ui test.

    I have followed all the instructions above. What is the best solution here?

    • I guess you are using nUnit for test execution, right?
      But unfortunately, nUnit can’t copy the jar file to output directory.

      Try to use Visual Studio Unit Test framework for case organisation and execution, this helped me.

  19. Hi,

    I installed SikuliModule the way instructed above. But, when I type SikuliAction.Click, Visual Studio complains, saying it is a method, but is used like a “type”. I have installed both Jre 7 and Jre 6, but pointing JAVA_HOME to Jre6.

    • Also, it wasn’t specified in the instruction whether to put the JAVA_HOME variable in the “User variables” section, or the “system variables” section. I put it in the “system variables” section.

  20. Rahul Thakur said:

    Great work! Solved my problem of wanting to use Sikuli from .NET 🙂

    Could you please let me know what the licensing terms for SikuliIntegrator are? Is the source code for JSikuliModule.jar openly available?

    • Eider said:

      Congratulations!

    • umakanth said:

      Hi Rahul,
      Could you please let me know what did u do to resolve the above error ‘ unable to access jar file….” which is there in out folder

  21. John said:

    Hi, I hope you’ll see this message.

    I followed your method and installed the ‘SikuliIntegrator’ Nugget package and managed to successfully reference ‘SikuliModule’ in my test project. However, when I download the sample projects you’ve provided on Google code SVN, and run it, ‘SikuliModule;’ is not automatically referenced in the project. Therefore I then follow the Nugget package method to install ‘SikuliIntegrator’ but `SikuliModule` still does not get referenced.

    Do you have any idea what the problem might be? Thanks in advance.

  22. Tomasz Siuda said:

    Hello all,
    Is it possible to type special keys (Ctrl-A, Ctrl-C) using Sikuli Integrator?
    Basically I need to check the text appearing in an edit box. The standard Sikuli IDE allows to perform a sequence of operations: Click in the middle of the box -> use Type(‘a’, KeyModifier.CTRL) to select all -> use Type(‘c’, KeyModifier.CTRL) to copy edit contents to clipboard -> read the clipboard. I want to replicate the same sequence with Sikuli integrator but I’m not sure how.
    I would appreciate your help.

  23. Olga said:

    Hi Angel,

    I am having this error when trying to run my test in Visual studio:

    Unable to access jarfile C:\Users\[user name]\AppData\Local\Temp\8af4503d-3271-41ac-b8db-5c9f604f0685\8af4503d-3271-41ac-b8db-5c9f604f0685\assembly\dl3\6079e58b\81a24f6c_dcf3cf01\JSikuliModule.jar.

    I have tried to run Visual studio as administrator, I have also setup the same java version as the one you used for testing (jre-6u35-windows-i586.exe) in my C:\Program Files (x86).

    My java bin folder is in the Path as well.

    Do you have any other ideas how I could fix it?

    Thanks!

  24. I have tried to run this sample project and am running into the following error. I’ll go search Google, but just wanted to let other folks know about this error:

    Exception in thread “main” java.lang.UnsatisfiedLinkError: C:\Users\Dev\AppData\Local\Temp\tmplib\VisionProxy.dll: Can’t find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(Unknown Source)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at com.wapmx.nativeutils.jniloader.NativeLoader.loadLibrary(NativeLoader.java:44)
    at org.sikuli.script.Finder.(Finder.java:33)
    at org.sikuli.script.Region.doFind(Region.java:1029)
    at org.sikuli.script.Region$RepeatableFind.run(Region.java:1232)
    at org.sikuli.script.Region$Repeatable.repeat(Region.java:1203)
    at org.sikuli.script.Region.waitVanish(Region.java:565)
    at com.sikuliintegrator.Operation.WaitVanish(Operation.java:204)
    at com.sikuliintegrator.Pointer.main(Pointer.java:118)

  25. Raluca Suditu said:

    Hi, I’m going to ask the same question as Tomasz Siuda. It seems that this dll does not allow us to simulate keys like Tab, Enter etc when typing something. This is a very important functionality, because it can significantly decrease the execution time, and we don’t need to capture so many images. It is very useful in popup to identify only the first field in the popup and then to navigate to the others with Tab, enter info etc.
    Do you know if it’s possible to support this in your dll?

  26. Raghukiran said:

    Hi Angel,

    We are facing problem when we are trying to execute the “SikuliAction.Wait” command. It throws the error “Exception in thread “main” java.lang.UnsatisfiedLinkError: C:\Users\**User**\AppData\Local\Temp\tmplib\VisionProxy.dll: Can’t find dependent libraries”

    We ensure that the correct version of Java -1.6 is available and the
    Environment variable has the SIKULI_HOME path and path to Sikuli\lib folder.

    We are blocked because of this. Also, SikuliAction.Type command is not available in 1.1.0.

    Also, the tests does not throw exception to indicate the failure as they are written only in the log file about the failure.

    Looks like the build is not stable

    Thanks,
    Raghukiran

  27. Hi,
    We’re experiencing an issue with the Sikuli image recognition – where clicks doesn’t work, and automated process crashes.
    We were able to save the images, record the process, but when the recorded automation should’ve click on the banner – it didn’t respond, and the automated process crashes.

    Thanks, Rita

  28. Hi,
    I’m really happy with your Sikuli In C. But, there is a problem with Exists Function. It’s fine when Sikuli can find the object on screen. But when Sikuli can’t find the object, VS “Throw” a Exception: There is no matching element. Could you show me how to fix that issue?

    Here is my code
    If(SikuliAction_Exists(@”C:\Users\Trung7\Desktop\ClickPopupMenu.png”, 10).IsEmpty)
    {
    MessageBox.Show(“No”);
    }
    else
    {
    MessageBox.Show(“Yes”);
    }

    It doesnt show MessageBox “No”, but it throws:

    Exception:Caught: “###1:There is no matching element
    ###FAILURE

    • Hi,

      Requsting some help.

      When i tried my code facing some exception

      SikuliAction.DoubleClick(@”C:\Activities\ImageRepository\Go_online.png”, k, 5);

      it’s throwing following exception
      An exception of type ‘System.ComponentModel.Win32Exception’ occurred in System.dll but was not handled in user code

      Additional information: The system cannot find the file specified

      But in the provided Path image is available

      If u have any idea help me out.

      Thanks in Advance

  29. Francisco said:

    Hi,
    I’ve been using this for some tests and i’ve noticed something: the commands with coordinates are not included.
    I have a window that has many buttons and fields that are exactly the same and to know which onde to click i was going to give the button offset to the command. But i’ve noticed that it is not possible. The commands as they are right now, are not capable of receiving offsets, just the picture.
    Can you tell me if that part of code is in some folder i didn’t notice, or help me with this in any way?

    Thanks

  30. Francisco said:

    Hello,

    I actually had the same problem Mikhail initially had: when i use the commands Wait or DoubleClick i get the error “Win32Util.dll: Can’t load IA 32-bit .dll on a AMD 64-bit
    platform”.
    Can anyone help?

  31. Kevin said:

    Hi,

    I have a problem. When I use Exist i get an error:

    An unhandled exception of type ‘System.Exception’ occurred in SikuliModule.dll

    Additional information: ###FAILURE

    this is my code:

    if (SikuliAction.Exists(pattern, Similarity90, Timeout5S).IsEmpty)
    {
    labelTest.Text = “Yes”;
    }
    else
    {
    labelTest.Text = “No”;
    }

    Can anyone help me?

  32. How Can I type data into any textbox or textarea? As we have Type method in while working with java. Is there any alternate to this?

  33. Anuj Verma said:

    how can i change default logging directory of Sikuli for step : Set “Copy to Output Directory” property to “Copy always”

  34. Med Amin said:

    I try to use Sikuli Integrator for C#. I create new project in Visual Studio 2015, and I Install SikuliIntegrator. After the installation JSikuliModule.jar, it will be part of my solution, together with some additional files. After that Properties to set “Copy to Output Directory” property to “Copy always” of JSikuliModule.jar
    String img = @”C:\Users\amin-\Documents\Visual Studio 2015\Projects\SikuliTestV2\SikuliTestV2″;
    SikuliModule.SikuliAction.Click(img);

    If I run the code, this is the errors shows :

    An unhandled exception of type ‘System.UnauthorizedAccessException’ occurred in mscorlib.dll Additional information: Access to the path ‘C:\SikuliOutputLog.txt’ is denied.

    If I run the code as an administrator, this is the errors shows :

    An unhandled exception of type ‘System.Exception’ occurred in SikuliModule.dl Additional information: ###FAILURE

    • you can create a text file(SikuliOutputLog.txt) manually in C:\ . it works for me

  35. Madhavi said:

    Hi,

    I am using Sikuli Integrator for C#. I installed the jSikuliModule.jar into my VS2012 Project.

    I am able to perform SikuliAction.Click(Pattern). But, when I perform “SikuliAction.Double_Click”, I am getting the error: Can’nt find dependent libraries at java.lang.Classloader$NativeLibrary.load(Native Method) at java.lang.classloader.loadlibrary1(Unknown source) and so on…dependent libraries.

    Can you please tell me solution for the problem.

    Thanks,
    Madhavi

  36. Yasmeen said:

    Can you please let know the solution for Unable to access jar file from test results folder

    • kar said:

      I found the exact issue, but not sure how to solve it.

      here’s is my finding when we run the test 2 things are happening at background
      1. Deployment process running and creating under test result directory
      2. Execution result process running after the deployment.

      C:\Users\kar\Documents\visual studio 2017\Projects\CUI\TestResults\Kar 2017-05-24 12_27_27\Out

      while execution JSikuliModule.jar should copy automatically. However it’ not copying to the out directory. I copied manually while debugging and it’s works fine.

    • I found a solution for this issue unable to access Jar file.

      We have to copy this JSikuliModule.jar file to test out directory externally. use the below code to copy the jar to output directory

      public CodedUITest1()
      {
      File.Copy(@”C:\Users\Kar\Documents\Visual Studio 2017\Projects\CUI\JSikuliModule.jar”,
      Path.Combine(Environment.CurrentDirectory, “JSikuliModule.jar”), true);
      Console.WriteLine(Environment.CurrentDirectory);
      }

  37. HI Guys,

    I’m having troubles with this error and I’m not sure how to handle it.

    I’m sure though, I have made configured the JAVA_HOME variables correct java – version brings correct java version. besides as far as I understand sikuliintegrator enters to sikulimodule.jar but after that it trying to navigate to some files which are not even in my machine

    this is the stack trace:
    System.Exception: ###FAILURE
    Result StackTrace:
    at SikuliModule.Commander.ConsumeResult(String output, String error) in c:\Users\Angel\Dropbox\Projects\SikuliModule\SikuliModule\Commander.cs:line 103
    at SikuliModule.Commander.Execute(Command command, String mainPattern, String extraPattern, Single similarity, Int32 timeout) in c:\Users\Angel\Dropbox\Projects\SikuliModule\SikuliModule\Commander.cs:line 73
    at SikuliModule.SikuliAction.Click(String pattern) in c:\Users\Angel\Dropbox\Projects\SikuliModule\SikuliModule\SikuliAction.cs:line 46

    and these are files which are not in my machine
    a) c:\Users\Angel\Dropbox\Projects\SikuliModule\SikuliModule\SikuliAction.cs:line
    b) c:\Users\Angel\Dropbox\Projects\SikuliModule\SikuliModule\SikuliAction.cs:

    please advise

  38. Swapna said:

    Hi ,

    Iam using ‘Sikuli Integrator’, it is not clicking on the image on Agent machine.
    The Agent machine is having jre 1.8 installed and configured environment variable properly.
    And .Net framework installed on it.

    Is there anything Iam missing ..Could any one help me.

    Thanks,
    Swapna

  39. Hana said:

    Hi,
    I’m also facing the problem “unable to access jar file” while using sikuliModule.
    I just add SikuliAction.Exists(imagepath) in my CodedUI project.
    And the callstack is stopped on Commander.ConsumerResult(), please help!

  40. […] How to use Sikuli in my C# coded tests? […]

  41. kar said:

    Anyone found a solution for not able to access JSikuliModule.Jar ??

    I found the exact issue, but not sure how to solve it.

    here’s is my finding when we run the test 2 things are happening at background
    1. Deployment process running and creating under test result directory
    2. Execution result process running after the deployment.
    C:\Users\kar\Documents\visual studio 2017\Projects\CUI\TestResults\Kar 2017-05-24 12_27_27\Out
    while execution JSikuliModule.jar should copy automatically. However it’ not copying to the out directory.
    I copied manually while debugging and it’s works fine.

    Anybody can help me to fix the issue ??

    • I found a solution for this issue unable to access Jar file.

      We have to copy this JSikuliModule.jar file to test out directory externally. use the below code to copy the jar to output directory

      public CodedUITest1()
      {
      File.Copy(@”C:\Users\Kar\Documents\Visual Studio 2017\Projects\CUI\JSikuliModule.jar”,
      Path.Combine(Environment.CurrentDirectory, “JSikuliModule.jar”), true);
      Console.WriteLine(Environment.CurrentDirectory);
      }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: