Sikuli集成商C# [英] Sikuli Integrator C#
问题描述
我想在C#中使用SikuliIntegrator. 我以管理员身份运行VS,通过NuGet管理器安装SikuliIntegrator,并想在简单的任务上对其进行测试.
I want to use SikuliIntegrator in C#. I run VS as administrator, install SikuliIntegrator throught NuGet manager and want to test him on simple task.
在这里输入我的代码
using SikuliModule;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SikuliTrainingNet
{
class Program
{
static void Main(string[] args)
{
string MyPicture = @"c:\111\Sik\MyPicture.png";
SikuliAction.Click(MyPicture);
}
}
}
运行代码(并在屏幕上准备好MyPicture)后,我得到的只是异常"### FAILURE",为什么?
after running code (and have prepared MyPicture on screen), all i get is exception "###FAILURE" any idea why?
我不想使用Sikuli4Net,因为它看起来像可以在Web APS上工作,并且我只需要单击几下桌面应用程序即可.
I dont wanna use Sikuli4Net, becose its look like it work on web aps and I need just few simple clicks on desktop aplication.
我尝试用Java编写sikuli,并且在那里工作没有问题.但是我需要用C#编写程序.
I try sikuli in Java, and there it works with no problem. But I need to make my program in C#.
推荐答案
我在C#中将此代码用于Sikuli4Net,它首先对我有用.您需要添加参考文献,请参阅此链接以获取参考文献 http://interviews.ga/angularjs/sikulic/
I Used This Code For Sikuli4Net in C#,It Was Working For Me First You need add the References please see this link for Reference http://interviews.ga/angularjs/sikulic/
static void Main(string[] args)
{
APILauncher launch = new APILauncher(true);
Pattern image1 = new Pattern(@"C:\Users\Ramesh\Desktop\Images\userName.png");
Pattern image2 = new Pattern(@"C:\Users\Ramesh\Desktop\Images\password.png");
Pattern image3 = new Pattern(@"C:\Users\Ramesh\Desktop\Images\Login.png");
launch.Start();
IWebDriver driver = new ChromeDriver();
driver.Manage().Window.Maximize();
driver.Url = "http://gmail.com";
Screen scr = new Screen();
scr.Type(image1, "abc@gmail.com", KeyModifier.NONE);
scr.Type(image2, "12345", KeyModifier.NONE);
scr.Click(image3, true);
Console.ReadLine();
}
这篇关于Sikuli集成商C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!