use of org.openqa.selenium.WebDriver in project selenium-tests by Wikia.
the class FacebookSignupModalComponentObject method acceptWikiaAppPolicyNoEmail.
public void acceptWikiaAppPolicyNoEmail() {
new WebDriverWait(driver, 10).until(new ExpectedCondition<Boolean>() {
@Nullable
@Override
public Boolean apply(WebDriver input) {
return input.getWindowHandles().size() > 1;
}
});
Object[] handles = driver.getWindowHandles().toArray();
driver.switchTo().window(handles[1].toString());
wait.forElementVisible(By.cssSelector("button[name='__CONFIRM__']"));
appTermsConfirmButton.click();
driver.switchTo().window(handles[0].toString());
}
use of org.openqa.selenium.WebDriver in project selenium-tests by Wikia.
the class DropDownComponentObject method openDropDown.
/**
* Open dropdown - we need to move mouse outside the element and move back to element to trigger
* the event
*/
public DropDownComponentObject openDropDown() {
driver.manage().timeouts().implicitlyWait(500, TimeUnit.MILLISECONDS);
try {
new WebDriverWait(driver, 20, 2000).until(new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver webDriver) {
if (!driver.findElement(By.cssSelector(LOGIN_DROPDOWN_TRIGGER_CSS)).getAttribute("class").contains("active")) {
((JavascriptExecutor) driver).executeScript("$j('.ajaxLogin .avatar-container').trigger('click')");
return false;
}
return true;
}
});
} finally {
restoreDefaultImplicitWait();
}
PageObjectLogging.log("DropdownVisible", "Login dropdown is visible", true, driver);
return this;
}
use of org.openqa.selenium.WebDriver in project selenium-tests by Wikia.
the class TopNoteModalDialog method clickApprove.
public void clickApprove() {
super.clickConfirm();
new WebDriverWait(driver, DiscussionsConstants.TIMEOUT).until((Predicate<WebDriver>) input -> !post.getAttribute("class").contains("is-reported"));
}
use of org.openqa.selenium.WebDriver in project selenium-tests by Wikia.
the class DeleteDialog method confirmAndWait.
public void confirmAndWait() {
super.clickConfirm();
new WebDriverWait(driver, DiscussionsConstants.TIMEOUT).until((Predicate<WebDriver>) input -> postList.stream().allMatch(p -> p.getAttribute("class").contains("is-deleted")));
}
use of org.openqa.selenium.WebDriver in project selenium-tests by Wikia.
the class AdsComparison method isAdVisible.
public boolean isAdVisible(final WebElement element, final String selector, final WebDriver driver) {
hideSlot(selector, driver);
final BufferedImage backgroundImg = shooter.takeScreenshot(element, driver);
PageObjectLogging.log("ScreenshotsComparison", "Background image in " + selector, true, driver);
showSlot(selector, driver);
try {
WebDriverWait wait = new WebDriverWait(driver, AD_TIMEOUT_SEC);
wait.until(new ExpectedCondition<Object>() {
@Override
public Object apply(WebDriver driver) {
BufferedImage adImg = shooter.takeScreenshot(element, driver);
PageObjectLogging.log("ScreenshotsComparison", "Ad image in " + selector, true);
if (adImg.getHeight() == 1 || imageComparison.isMonocolorImage(adImg)) {
return false;
}
return imageComparison.areImagesDifferent(backgroundImg, adImg, IMAGES_THRESHOLD_PERCENT);
}
});
} catch (TimeoutException e) {
PageObjectLogging.logWarning("ScreenshotsComparison", e);
return false;
}
return true;
}
Aggregations