use of org.sikuli.script.Pattern in project selenium_java by sergueik.
the class AppTest method testUpload.
@Ignore
@Test
public // https://www.youtube.com/watch?v=8OfnQEfzfmw
void testUpload() {
String openButtonImage = fullPath("open_1920x1080.png");
Pattern filenameTextBox = new Pattern(fullPath("filename_1920x1080.png"));
driver.navigate().to(getPageContent("upload.html"));
try {
File tmpFile = File.createTempFile("foo", ".png");
WebElement element = driver.findElement(By.tagName("input"));
element.click();
try {
screen.exists(openButtonImage, sikuliTimeout);
screen.type(filenameTextBox, tmpFile.getCanonicalPath());
System.out.println("Uploading: " + tmpFile.getCanonicalPath());
screen.click(openButtonImage, 0);
} catch (FindFailed e) {
verificationErrors.append(e.toString());
}
try {
element = driver.findElement(By.tagName("input"));
highlight(element);
assertThat(element.getAttribute("value"), containsString(tmpFile.getName()));
} catch (Error e) {
verificationErrors.append(e.toString());
}
} catch (IOException e) {
throw new RuntimeException(e.toString());
}
}
use of org.sikuli.script.Pattern in project sakuli by ConSol.
the class RegionImpl method find.
/**
* {@link Region#find(String)}.
*/
public RegionImpl find(String imageName) {
Match match;
Pattern imagePattern = loadPattern(imageName);
try {
match = this.find(imagePattern);
} catch (FindFailed findFailed) {
match = null;
}
if (match != null) {
return toRegion(match);
}
loader.getExceptionHandler().handleException("Can't find \"" + imagePattern + "\" in " + this.toString(), this, resumeOnException);
return null;
}
Aggregations