List of usage examples for org.openqa.selenium.support.ui ExpectedConditions elementToBeClickable
public static ExpectedCondition<WebElement> elementToBeClickable(final WebElement element)
From source file:org.cerberus.service.engine.impl.WebDriverService.java
License:Open Source License
private AnswerItem<WebElement> getSeleniumElement(Session session, Identifier identifier, boolean visible, boolean clickable) { AnswerItem<WebElement> answer = new AnswerItem<WebElement>(); MessageEvent msg;//from w ww .j a v a 2 s. c o m By locator = this.getBy(identifier); MyLogger.log(WebDriverService.class.getName(), Level.DEBUG, "Waiting for Element : " + identifier.getIdentifier() + "=" + identifier.getLocator()); try { WebDriverWait wait = new WebDriverWait(session.getDriver(), session.getDefaultWait()); WebElement element; if (visible) { if (clickable) { element = wait.until(ExpectedConditions.elementToBeClickable(locator)); } else { element = wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); } } else { element = wait.until(ExpectedConditions.presenceOfElementLocated(locator)); } answer.setItem(element); msg = new MessageEvent(MessageEventEnum.ACTION_SUCCESS_WAIT_ELEMENT); msg.setDescription(msg.getDescription().replace("%ELEMENT%", identifier.getIdentifier() + "=" + identifier.getLocator())); } catch (TimeoutException exception) { MyLogger.log(WebDriverService.class.getName(), Level.FATAL, "Exception waiting for element :" + exception); //throw new NoSuchElementException(identifier.getIdentifier() + "=" + identifier.getLocator()); msg = new MessageEvent(MessageEventEnum.ACTION_FAILED_WAIT_NO_SUCH_ELEMENT); msg.setDescription(msg.getDescription().replace("%ELEMENT%", identifier.getIdentifier() + "=" + identifier.getLocator())); } answer.setResultMessage(msg); return answer; }
From source file:org.cerberus.service.webdriver.impl.WebDriverService.java
License:Open Source License
private AnswerItem<WebElement> getSeleniumElement(Session session, Identifier identifier, boolean visible, boolean clickable) { AnswerItem<WebElement> answer = new AnswerItem<WebElement>(); MessageEvent msg;/*from w ww.ja va 2s . c om*/ By locator = this.getBy(identifier); MyLogger.log(WebDriverService.class.getName(), Level.DEBUG, "Waiting for Element : " + identifier.getIdentifier() + "=" + identifier.getLocator()); try { WebDriverWait wait = new WebDriverWait(session.getDriver(), TimeUnit.MILLISECONDS.toSeconds(session.getCerberus_selenium_wait_element())); WebElement element; if (visible) { if (clickable) { element = wait.until(ExpectedConditions.elementToBeClickable(locator)); } else { element = wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); } } else { element = wait.until(ExpectedConditions.presenceOfElementLocated(locator)); } answer.setItem(element); msg = new MessageEvent(MessageEventEnum.ACTION_SUCCESS_WAIT_ELEMENT); msg.setDescription(msg.getDescription().replace("%ELEMENT%", identifier.getIdentifier() + "=" + identifier.getLocator())); } catch (TimeoutException exception) { MyLogger.log(WebDriverService.class.getName(), Level.FATAL, "Exception waiting for element :" + exception); //throw new NoSuchElementException(identifier.getIdentifier() + "=" + identifier.getLocator()); msg = new MessageEvent(MessageEventEnum.ACTION_FAILED_WAIT_NO_SUCH_ELEMENT); msg.setDescription(msg.getDescription().replace("%ELEMENT%", identifier.getIdentifier() + "=" + identifier.getLocator())); } answer.setResultMessage(msg); return answer; }
From source file:org.cerberus.service.webdriver.impl.WebDriverService.java
License:Open Source License
@Override public boolean isElementNotClickable(Session session, Identifier identifier) { By locator = this.getBy(identifier); MyLogger.log(WebDriverService.class.getName(), Level.DEBUG, "Waiting for Element to be not clickable : " + identifier.getIdentifier() + "=" + identifier.getLocator()); try {/* w w w. j av a2 s . co m*/ WebDriverWait wait = new WebDriverWait(session.getDriver(), TimeUnit.MILLISECONDS.toSeconds(session.getCerberus_selenium_wait_element())); return wait.until(ExpectedConditions.not(ExpectedConditions.elementToBeClickable(locator))); } catch (TimeoutException exception) { MyLogger.log(WebDriverService.class.getName(), Level.FATAL, "Exception waiting for element to be not clickable :" + exception); return false; } }
From source file:org.cerberus.serviceEngine.impl.WebDriverService.java
License:Open Source License
private WebElement getSeleniumElement(Session session, String input, boolean visible, boolean clickable) { By locator = this.getIdentifier(input); MyLogger.log(RunTestCaseService.class.getName(), Level.DEBUG, "Waiting for Element : " + input); try {/* w w w. j a v a 2 s. co m*/ WebDriverWait wait = new WebDriverWait(session.getDriver(), session.getDefaultWait()); if (visible) { if (clickable) { wait.until(ExpectedConditions.elementToBeClickable(locator)); } else { wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); } } else { wait.until(ExpectedConditions.presenceOfElementLocated(locator)); } } catch (TimeoutException exception) { MyLogger.log(RunTestCaseService.class.getName(), Level.FATAL, "Exception waiting for element :" + exception); throw new NoSuchElementException(input); } MyLogger.log(RunTestCaseService.class.getName(), Level.DEBUG, "Finding Element : " + input); return session.getDriver().findElement(locator); }
From source file:org.eclipse.che.selenium.pageobject.CreateFactoryWidget.java
License:Open Source License
/** click on invoke button */ public void clickOnInvokeBtn() { waitOpen();//from ww w . ja v a 2 s .co m try { invokeFactoryBtn.click(); } catch (WebDriverException ex) { new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) .until(ExpectedConditions.elementToBeClickable(invokeFactoryBtn)).click(); } }
From source file:org.eclipse.che.selenium.pageobject.dashboard.DashboardFactory.java
License:Open Source License
/** Click on 'Workspaces' tab on 'Select Source' widget */ public void clickWorkspacesTabOnSelectSource() { new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) .until(ExpectedConditions.elementToBeClickable(workspaceTabSelect)).click(); }
From source file:org.eclipse.che.selenium.pageobject.dashboard.DashboardFactory.java
License:Open Source License
/** Click on 'Add' button on 'Configure Action' widget */ public void clickOnAddConfigureActions() { new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) .until(ExpectedConditions.elementToBeClickable(addConfigureAction)).click(); }
From source file:org.eclipse.che.selenium.pageobject.dashboard.DashboardFactory.java
License:Open Source License
/** Click on 'Open' button on the factory properties widget */ public void clickOnOpenFactory() { dashboard.waitNotificationIsClosed(); new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) .until(ExpectedConditions.elementToBeClickable(openFactoryButton)).click(); }
From source file:org.eclipse.che.selenium.pageobject.dashboard.DashboardFactory.java
License:Open Source License
/** click 'Add' button on 'Add Action' window */ public void clickAddOnAddAction() { new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) .until(ExpectedConditions.elementToBeClickable(By.xpath(AddActionWindow.ADD_XPATH))).click(); }
From source file:org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace.java
License:Open Source License
public void waitDownloadWorkspaceJsonFileBtn() { new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) .until(ExpectedConditions.elementToBeClickable(downloadWsJsonBtn)); }