List of usage examples for org.openqa.selenium.support.ui ExpectedConditions elementToBeClickable
public static ExpectedCondition<WebElement> elementToBeClickable(final WebElement element)
From source file:net.atf4j.webdriver.page.AbstractPageObject.java
License:Open Source License
/** * Click when ready.//from ww w.ja va2 s . com * * @param webElement the web element */ public void clickWhenReady(final WebElement webElement) { verifyNotNull(webElement); this.webDriverWait.until(ExpectedConditions.elementToBeClickable(webElement)); webElement.click(); }
From source file:net.atf4j.webdriver.page.AbstractPageObject.java
License:Open Source License
/** * Wait until webElement is clickable.//from w w w. j a va2 s.c o m * * @param webElement the web element * @return the web element when clickable, otherwise TimeoutException. */ public WebElement waitUntilClickable(final WebElement webElement) { verifyNotNull(webElement); return this.webDriverWait.until(ExpectedConditions.elementToBeClickable(webElement)); }
From source file:net.roddrim.number5.web.selenium.SeleniumWebDriverBot.java
License:Apache License
@Override public void waitForElementToBeClickable() { wait.until(ExpectedConditions.elementToBeClickable(current)); }
From source file:nz.co.testamation.core.client.SeleniumBrowserDriver.java
License:Apache License
@Override public void waitForClickable(By by) { new WebDriverWait(getDriver(), elementWaitTimeInSeconds).until(ExpectedConditions.elementToBeClickable(by)); }
From source file:org.alfresco.po.common.renderable.Renderable.java
License:Open Source License
/** * Wait for the annotated html elements on this renderable item */// w w w. j a v a2 s . c om private void waitFor() { for (Map.Entry<WrapsElement, WaitFor> entry : getWaitForHTMLElements().entrySet()) { WrapsElement element = entry.getKey(); switch (entry.getValue().status()) { case VISIBLE: { webDriverWait().until(ExpectedConditions.visibilityOf(element.getWrappedElement())); break; } case HIDDEN: { webDriverWait().until( ExpectedConditions.not(ExpectedConditions.visibilityOf(element.getWrappedElement()))); break; } case CLICKABLE: { webDriverWait().until(ExpectedConditions.elementToBeClickable(element.getWrappedElement())); break; } } } }
From source file:org.alfresco.po.PageElement.java
License:Open Source License
/** * Wait until the Clickable of given Element for given seconds. * /*from ww w . j ava 2s . c o m*/ * @param locator CSS Locator * @param timeOutInSeconds Timeout In Seconds */ public void waitUntilElementClickable(By locator, long timeOutInSeconds) { if (locator == null) { throw new IllegalArgumentException(LOCATOR_REQUIRED_ERR_MSG); } WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds); wait.until(ExpectedConditions.elementToBeClickable(locator)); }
From source file:org.alfresco.po.RenderElement.java
License:Open Source License
/** * Wait until the Clickable of given Element for given seconds. * /*w ww . j av a2 s. c o m*/ * @param driver WebDriver * @param locator CSS Locator * @param timeOutInSeconds Timeout In Seconds */ public void waitUntilElementClickable(WebDriver driver, By locator, long timeOutInSeconds) { if (locator == null) { throw new IllegalArgumentException(LOCATOR_REQUIRED_ERR_MSG); } WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds); wait.until(ExpectedConditions.elementToBeClickable(locator)); }
From source file:org.alfresco.po.rm.disposition.edit.steps.EventsSection.java
License:Open Source License
/** * Select Event/*w w w . j av a2 s.co m*/ */ public EventsSection selectEvent(final String eventName) { // click on add event button clickOnAddEvent(); Utils.retry(new Retry<Void>() { public Void execute() { // find the correct event link boolean eventClicked = false; StringBuffer eventsChecked = new StringBuffer(255); List<WebElement> eventLinks = availableEvents.findElements(By.cssSelector("a.yuimenuitemlabel")); for (WebElement eventLink : eventLinks) { // get the text in the event link String eventLinkText = eventLink.getText().trim(); eventsChecked.append(eventLinkText).append(", "); if (eventName.equals(eventLinkText)) { // wait for the event link to be clickable Utils.webDriverWait().until(ExpectedConditions.elementToBeClickable(eventLink)); // click event link eventLink.click(); eventClicked = true; break; } } // if no event clicked throw exception if (eventClicked == false) { throw new RuntimeException("The event " + eventName + " could not be added from a list of " + eventLinks.size() + " events [" + eventsChecked.toString() + "]"); } return null; } }, 5); return this; }
From source file:org.apache.archiva.web.test.ArchivaAdminTest.java
License:Apache License
@Test public void testInitialRepositories() { WebDriverWait wait = new WebDriverWait(getWebDriver(), 20); WebElement el;/*w w w . j av a 2s .c o m*/ el = wait.until(ExpectedConditions.elementToBeClickable(By.id("menu-repositories-list-a"))); tryClick(el, ExpectedConditions.presenceOfElementLocated( By.xpath("//table[@id='managed-repositories-table']//td[contains(text(),'internal')]")), "Managed Repositories not activated"); wait.until(ExpectedConditions.visibilityOfElementLocated( By.xpath("//table[@id='managed-repositories-table']//td[contains(text(),'snapshots')]"))); el = wait.until( ExpectedConditions.elementToBeClickable(By.xpath("//a[@href='#remote-repositories-content']"))); tryClick(el, ExpectedConditions.visibilityOfElementLocated( By.xpath("//table[@id='remote-repositories-table']//td[contains(text(),'central')]")), "Remote Repositories View not available"); }
From source file:org.apache.archiva.web.test.parent.AbstractArchivaTest.java
License:Apache License
private void createUser(String userName, String fullName, String emailAd, String password, String confirmPassword, boolean valid) { login(getAdminUsername(), getAdminPassword()); WebDriverWait wait = new WebDriverWait(getWebDriver(), 10); WebElement el = wait.until(ExpectedConditions.elementToBeClickable(By.id("menu-users-list-a"))); el = tryClick(el, ExpectedConditions.elementToBeClickable(By.id("users-view-tabs-li-user-edit-a")), "User List not available"); el = tryClick(el, ExpectedConditions.elementToBeClickable(By.id("users-view-tabs-li-user-edit-a")), "User Edit View not available"); el = tryClick(el, ExpectedConditions.elementToBeClickable(By.id("user-create-form-register-button")), "Register Form not available"); assertCreateUserPage();//from w ww . ja va 2s . c o m setFieldValue("username", userName); setFieldValue("fullname", fullName); setFieldValue("email", emailAd); setFieldValue("password", password); setFieldValue("confirmPassword", confirmPassword); el.click(); if (valid) { wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id("user-messages"), "User " + userName + " created.")); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("users-grid-user-id-" + userName))); //String[] columnValues = { userName, fullName, emailAd }; //assertElementPresent( XPathExpressionUtil.getTableRow( columnValues ) ); } else { assertCreateUserPage(); } }