use of org.openqa.selenium.NoSuchElementException in project devonfw-testing by devonfw.
the class DriverExtention method waitForElementVisible.
public WebElement waitForElementVisible(final By by) throws BFElementNotFoundException {
BasePage.getAnalytics().sendMethodEvent(BasePage.analitycsCategoryName);
long startTime = System.currentTimeMillis();
WebElement element = null;
try {
element = webDriverWait().until((Function<? super WebDriver, WebElement>) ExpectedConditions.visibilityOfElementLocated(by));
} catch (TimeoutException | NoSuchElementException e) {
boolean isTimeout = true;
throw new BFElementNotFoundException(by, isTimeout, BasePage.EXPLICITYWAITTIMER);
}
BFLogger.logTime(startTime, "waitForElementVisible()", by.toString());
return element;
}
use of org.openqa.selenium.NoSuchElementException in project devonfw-testing by devonfw.
the class DriverExtention method waitForPageLoaded.
public void waitForPageLoaded() throws BFElementNotFoundException {
long startTime = System.currentTimeMillis();
final String jsVariable = "return document.readyState";
ExpectedCondition<Boolean> expectation = new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver driver) {
return ((JavascriptExecutor) driver).executeScript(jsVariable).equals("complete");
}
};
int progressBarWaitTimer = BasePage.PROGRESSBARWAITTIMER;
WebDriverWait wait = webDriverWait(progressBarWaitTimer);
try {
wait.until((Function<? super WebDriver, Boolean>) expectation);
} catch (TimeoutException | NoSuchElementException e) {
boolean isTimeout = true;
throw new BFElementNotFoundException(By.cssSelector(jsVariable), isTimeout, progressBarWaitTimer);
}
BFLogger.logTime(startTime, "waitForPageLoaded");
}
use of org.openqa.selenium.NoSuchElementException in project devonfw-testing by devonfw.
the class DriverExtention method findElementQuietly.
@SuppressWarnings("deprecation")
public WebElement findElementQuietly(WebElement elementToSearchIn, By by) {
BasePage.getAnalytics().sendMethodEvent(BasePage.analitycsCategoryName);
WebElement element = null;
try {
if (null == elementToSearchIn) {
element = getDriver().findElement(by);
} else {
element = new NewRemoteWebElement(elementToSearchIn).findElement(by);
}
} catch (NoSuchElementException e) {
BFLogger.logError("Element [" + by.toString() + "] was not found in given element");
}
return element;
}
use of org.openqa.selenium.NoSuchElementException in project devonfw-testing by devonfw.
the class NewFirefoxDriver method findElement.
/**
* @deprecated As of release 1.0.0, replaced by {@link #findElementDynamic(By)()}
*/
@Deprecated
@Override
public WebElement findElement(By by) throws BFElementNotFoundException {
BasePage.getAnalytics().sendMethodEvent(BasePage.analitycsCategoryName);
WebElement elementFromDriver = null;
try {
elementFromDriver = super.findElement(by);
} catch (NoSuchElementException e) {
throw new BFElementNotFoundException(by);
}
return new NewRemoteWebElement(elementFromDriver);
}
use of org.openqa.selenium.NoSuchElementException in project rubia-forums by flashboss.
the class CreatePost method createPost.
public static String createPost(WebDriver driver, PostBean post) {
WebElement home = driver.findElement(linkText(HOME_LINK));
home.click();
WebElement forumEl = driver.findElement(linkText(post.getTopic().getForum().getName()));
forumEl.click();
sleepThread();
WebElement topicSubject = driver.findElement(linkText(post.getTopic().getSubject()));
topicSubject.click();
sleepThread();
try {
WebElement bodyText = driver.findElement(className(REPLY_POST_BUTTON)).findElement(xpath("a[2]"));
bodyText.click();
} catch (NoSuchElementException e) {
return LOCKED;
}
sleepThread();
WebElement bodyInput = driver.findElement(cssSelector("div.ql-editor"));
bodyInput.sendKeys(post.getMessage().getText());
addAttachments(driver, post);
WebElement operationButton = driver.findElement(id(SUBMIT_BUTTON));
operationButton.click();
WebElement resultCreatePost = driver.findElement(xpath("//td[contains(@class,forumpostcontent)]/p[contains(text(),'" + post.getMessage().getText() + "')]"));
String updatedPost = resultCreatePost.getText();
return updatedPost;
}
Aggregations