Sikuli4Net: how to use targetOffset()

Asked by Kenneth.P on 2018-08-16

Hi.

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;
            options.AddArgument("--disable-infobars");
            var driver = new ChromeDriver(service, options);

            driver.Manage().Window.Size = new Size(1900, 1080);
            driver.Url = "http://www.google.dk/";

            Sikuli4Net.sikuli_REST.Screen scr = new Sikuli4Net.sikuli_REST.Screen();
            scr.Click(Image1);
            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

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2018-08-16
Last reply:
2018-08-16
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: http://sikulix.com

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.