Sikuli4Net: how to use targetOffset()

Asked by Kenneth.P on 2018-08-16


I've been trying to search pretty much everywhere for a solution to my problem.
But i have'nt been able to find it.

Im trying to use Sikuli for Visual studio 2017 (C#)

So far i got some of it working. I can find images and i can click and send text.
But i can't get things like .targetOffset() to work, it does'nt recognize the command.

Btw i' m new to programming so examples are appreciated :)

This is my current code:

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;
using Sikuli4Net.sikuli_UTIL;
using Sikuli4Net.sikuli_REST;

private void button1_Click(object sender, EventArgs e)
            APILauncher launch = new APILauncher();
            Pattern Image1 = new Pattern(@"C:\Users\Elliot\Desktop\Sikuli Images\Login.PNG");
            Pattern Image2 = new Pattern(@"C:\Users\Elliot\Desktop\Sikuli Images\Type-Email.PNG");

            ChromeOptions options = new ChromeOptions();
            ChromeDriverService service = ChromeDriverService.CreateDefaultService();
            service.HideCommandPromptWindow = true;
            var driver = new ChromeDriver(service, options);

            driver.Manage().Window.Size = new Size(1900, 1080);
            driver.Url = "";

            Sikuli4Net.sikuli_REST.Screen scr = new Sikuli4Net.sikuli_REST.Screen();
            scr.Type(Image2, "MyEmailHere");

            // I want to do something similar to this

            scr.Click(Image1).targetOffset(300, 0);

            // Error message: Operator '.' cannot be applied to operand of type 'void'

I hope someone can tell me what i'm missing?

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

Though you are using Sikuli4Net (a wrapper for SikuliX), it makes sense to read the docs about SikuliX.

start here:

targetOffset() is a method of a Pattern object.

Can you help with this problem?

Provide an answer of your own, or ask Kenneth.P for more information if necessary.

To post a message you must log in.