Sikuli与Selenium Webdriver信息集成

时间:2014-06-19 06:44:37

标签: selenium-webdriver sikuli

我已在构建路径中添加了所有必需的jar,但是当执行到达Sikuli API时出现此错误

[error] ResourceLoaderBasic: checkLibsDir: libs dir is not on system path: C:\Users\general\Desktop\Sikuli\libs
[action] ResourceLoaderBasic: checkLibsDir: Please wait! Trying to add it to user's path
[info] runcmd: reg QUERY HKCU 
[info] runcmd: reg QUERY HKEY_CURRENT_USER\Environment /v PATH 
[error] ResourceLoaderBasic: checkLibsDir: Logout and Login again! (Since libs folder is in user's path, but not activated)
[error] Terminating SikuliX after a fatal error!

抱歉,继续下去是没有意义的! 如果您对错误原因或解决方案一无所知,请再次运行 调试级别为3.您可以将输出粘贴到Q& A板上。

这是我的代码

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.sikuli.script.App;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;

public class Sikuli_test3 {

@Test
public void functionName() throws FindFailed {

// Create a new instance of the Firefox driver
WebDriver driver = new FirefoxDriver(); 


// And now use this to visit Google 
driver.get("http://www.google.co.in");

//WebElement element = driver.findElement( By.id("gbqfq"));
//element.sendKeys("Hello");
//element.click();

//Create and initialize an instance of Screen object    
Screen screen = new Screen();

//Add image path   
Pattern image = new Pattern("C:\\sikuli_images\\iam_feeling_lucky.png");

//Wait 10ms for image  
screen.wait(image, 10);

//Click on the image
screen.click(image);
  }
}

1 个答案:

答案 0 :(得分:0)

查看系统中是否存在用户定义的环境变量%SIKULI_HOME%,并将其添加到PATH环境变量中。如果存在,请重新启动系统。这应该工作。

http://doc.sikuli.org/faq/030-java-dev.html

如果这有助于您,请告诉我。