问题
enter image description here
screen.wait(username, 10);
I'm having an error message like at org.sikuli.script.Region.wait
and how can I run Sikuli integration with selenium projects in command prompt even I have added required Sikuli jar - while running in command prompt I'm getting as Sikuli package missing.
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);
回答1:
You need to use an exact path of an image like below code. Here I tested for google page for searching contents and click on google search button.
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);
}
}
I attached sample images how you can take a snapshot and match exactly while running sikuli program
来源:https://stackoverflow.com/questions/53066138/sikuli-integration-with-selenium-error-for-wait-condition