我想在C#中使用SikuliIntegrator。我以管理员身份运行VS,通过NuGet管理器安装SikuliIntegrator,并想在简单的任务中测试他。
下面是我的代码
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“,你知道为什么吗?
我不想使用Sikuli4Net,因为它看起来像是在web aps上工作,我只需要几个简单的点击桌面应用程序。
我在Java中尝试了sikuli,它在那里工作没有任何问题。但我需要用C#编写我的程序。
发布于 2017-08-07 13:10:34
我在C#的Sikuli4Net中使用了这个代码,它对我是有效的首先你需要添加参考请参阅参考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();
}
发布于 2015-08-25 21:30:07
我使用了这段代码,它工作得很好。首先,你应该打开你想要点击的网页,然后给出图像的路径(它应该是网页的一部分)
下面是我的代码:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SikuliModule;
using OpenQA.Selenium;
namespace WordPressAutomation.DifferentTests
{
[TestClass]
public class Sikuli
{
[TestMethod]
public void TestMethod1()
{
driver.Initialize();
driver.instance.Navigate().GoToUrl("https://www.google.co.in");
SikuliAction.Click("E:/img.png");
}
}
}
https://stackoverflow.com/questions/27837423
复制相似问题