use of org.sikuli.script.FindFailed in project selenium_java by sergueik.
the class AppTest method testSikuliFindBasic.
@Ignore
@Test
public // /blob/master/src/test/java/net/phptravels/home/HeaderTopOnFirefox.java
void testSikuliFindBasic() {
int width = 800;
int height = 600;
driver.manage().window().setSize(new Dimension(width, height));
String spanishFlagImage = fullPath("spanish_flag.png");
driver.get("http://phptravels.net/en");
WebElement languageElement = wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//div[contains(@class, 'navbar')]//a[@class='dropdown-toggle']"))));
assertThat(languageElement, notNullValue());
highlight(languageElement);
languageElement.click();
try {
if (screen.exists(spanishFlagImage, sikuliTimeout) != null) {
System.err.println("Found spanish flag image.");
screen.click(spanishFlagImage, 0);
}
} catch (FindFailed e) {
System.err.println("Can not Find flag image.");
verificationErrors.append(e.toString());
}
wait.until(ExpectedConditions.urlToBe("http://phptravels.net/es"));
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
}
use of org.sikuli.script.FindFailed 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.FindFailed in project sakuli by ConSol.
the class RegionImpl method findRegion.
/**
* {@link Region#findRegion(Region)}
*/
public RegionImpl findRegion(RegionImpl region) {
Match match;
try {
match = this.find(region);
} catch (FindFailed findFailed) {
match = null;
}
if (match != null) {
return toRegion(match);
}
loader.getExceptionHandler().handleException("Can't find \"" + region + "\" in this region!", this, resumeOnException);
return null;
}
use of org.sikuli.script.FindFailed in project sakuli by ConSol.
the class RegionImpl method rightClickMe.
/**
* {@link Region#rightClick()} ()}
*/
public RegionImpl rightClickMe() {
int ret;
try {
Location center = this.getCenter();
ret = this.rightClick(center);
} catch (FindFailed findFailed) {
ret = 0;
}
loader.loadSettingDefaults();
if (ret != 1) {
loader.getExceptionHandler().handleException("Couldn't right click on region " + this, this, resumeOnException);
return null;
}
return this;
}
use of org.sikuli.script.FindFailed in project sakuli by ConSol.
the class RegionImpl method doubleClickMe.
/**
* {@link Region#doubleClick()} ()}
*/
public RegionImpl doubleClickMe() {
int ret;
try {
Location center = this.getCenter();
ret = this.doubleClick(center);
} catch (FindFailed findFailed) {
ret = 0;
}
loader.loadSettingDefaults();
if (ret != 1) {
loader.getExceptionHandler().handleException("Couldn't double click on region " + this, this, resumeOnException);
return null;
}
return this;
}
Aggregations