screen.wait(用户名,10);
我收到类似org.sikuli.script.Region.wait
的错误消息,即使我已添加必需的Sikuli,如何在命令提示符中与硒项目运行Sikuli集成jar-在命令提示符下运行时,我无法获得Sikuli软件包。
Screen screen = new Screen();
Pattern fileUpload = new Pattern("a.PNG");
Pattern fileSelect = new Pattern("b.PNG");
Pattern AWBSelect = new Pattern("c.PNG");
Pattern AWBupload = new Pattern("d.PNG");
Pattern AWBSearch = new Pattern("e.PNG");
screen.wait(fileUpload, 10);
screen.click(fileUpload);
screen.wait(fileSelect, 10);
screen.click(fileSelect);
screen.type("a", KeyModifier.CTRL);
screen.type(Key.BACKSPACE,"C:\\Users\\PoojaPatange\\eclipse-workspacepractice\\CIToolAutomationRegression\\lib");
screen.type(Key.ENTER);
screen.wait(AWBSelect, 10);
screen.click(AWBSelect);
screen.wait(AWBupload, 10);
screen.click(AWBupload);
screen.wait(AWBSearch, 10);
screen.click(AWBSearch);
答案 0 :(得分:0)
您需要使用图像的确切路径,如以下代码所示。在这里,我测试了用于搜索内容的Google页面,然后单击Google搜索按钮。
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;
public class DemoWindowBasedApplication {
public static void main(String[] args) throws FindFailed {
Screen screen = new Screen();
Pattern image = new Pattern("C:\\Users\\test\\Videos\\snspshot\\october\\12\\google.png");
Pattern image1 = new Pattern("C:\\Users\\test\\Videos\\snspshot\\october\\12\\testGoogle.png");
Pattern googleSearch = new Pattern("C:\\Users\\test\\Videos\\snspshot\\october\\12\\googleSearch.png");
Pattern closeBrowser = new Pattern("C:\\Users\\test\\Videos\\snspshot\\october\\12\\close.png");
WebDriver driver;
System.setProperty("webdriver.gecko.driver",
"D:\\Automation\\Drivers_Automation\\geckodriver\\geckodriver.exe");
driver = new FirefoxDriver();
driver.get("http://www.google.com");
screen.click(image);
screen.type(image1,"Software testing");
screen.click(googleSearch);
screen.click(closeBrowser);
screen.wait(image, 10);
}
}
我附上了示例图像,以便您在运行sikuli程序时可以拍摄快照并进行精确匹配