List of usage examples for org.openqa.selenium.support.ui ExpectedConditions visibilityOfAllElementsLocatedBy
public static ExpectedCondition<List<WebElement>> visibilityOfAllElementsLocatedBy(final By locator)
From source file:org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils.java
License:Open Source License
public static List<WebElement> getEelementsByClassName(String element) { WebDriverWait wait = new WebDriverWait(driver, 3 * 60); return wait.until( ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//*[@class='" + element + "']"))); }
From source file:org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils.java
License:Open Source License
public static List<WebElement> getEelementsByContainsDataTestsId(String datatestId) { WebDriverWait wait = new WebDriverWait(driver, 3 * 60); return wait.until(ExpectedConditions .visibilityOfAllElementsLocatedBy(By.xpath("//*[contains(@data-tests-id, '" + datatestId + "')]"))); }
From source file:org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils.java
License:Open Source License
public static List<WebElement> getEelementsBycontainsClassName(String classname) { WebDriverWait wait = new WebDriverWait(driver, 3 * 60); return wait.until(ExpectedConditions .visibilityOfAllElementsLocatedBy(By.xpath("//*[contains(@class, '" + classname + "')]"))); }
From source file:org.orcid.integration.blackbox.client.Utils.java
License:Open Source License
public void colorBoxIsClosed() { getWait().until(ExpectedConditions .not(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//div[@id='colorbox']")))); }
From source file:org.orcid.integration.blackbox.web.SigninTest.java
License:Open Source License
public static void colorBoxIsClosed(WebDriverWait wait) { wait.until(ExpectedConditions// ww w . j av a 2s.co m .not(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//div[@id='colorbox']")))); }
From source file:org.orcid.integration.blackbox.web.works.AddWorksTest.java
License:Open Source License
public static void waitWorksLoading(WebDriverWait wait) { wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//div[@id='workSpinner']"))); }
From source file:org.pentaho.ctools.main.LoginPentaho.java
License:Open Source License
@Test public void testLoginPentaho() throws Exception { driver.get(baseUrl + "Login"); //Wait for form display wait.until(ExpectedConditions//from w w w . jav a2 s . c o m .visibilityOfElementLocated(By.xpath("//div[@id='login-form-container']/div/h1"))); assertEquals("User Console", driver.findElement(By.xpath("//div[@id='login-form-container']/div/h1")).getText()); driver.findElement(By.id("j_username")).clear(); driver.findElement(By.id("j_username")).sendKeys("admin"); driver.findElement(By.id("j_password")).clear(); driver.findElement(By.id("j_password")).sendKeys("password"); driver.findElement(By.cssSelector("button.btn")).click(); wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe[@id='home.perspective']"))); assertNotNull(driver.findElement(By.xpath("//iframe[@id='home.perspective']"))); assertEquals("Pentaho User Console", driver.getTitle()); //Go to the Home Perspective [IFRAME] driver.switchTo().frame("home.perspective"); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@class='well sidebar']"))); driver.findElement(By.xpath("//div[@class='well sidebar']/button")).click(); driver.switchTo().defaultContent(); wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.id("applicationShell"))); wait.until(ExpectedConditions .visibilityOfAllElementsLocatedBy(By.xpath("//iframe[@id='browser.perspective']"))); driver.switchTo().frame("browser.perspective"); wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//div[@id='fileBrowser']"))); wait.until( ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//div[@id='fileBrowserFolders']"))); assertNotNull(driver.findElement(By.xpath("//div[@id='fileBrowser']"))); }
From source file:org.testeditor.fixture.web.AbstractWebFixture.java
License:Open Source License
/** * Finds and returns a list of web element displayed on the page. If non * matching element, an empty list is returned. * //from w w w .j a v a 2 s . c om * @param elementListKey * key in the element list to find the technical locator * @param replaceArgs * values to replace the place holders in the element list entry * @return a list of available (present and not hidden) web elements * @throws StopTestException * if a timeout occurred */ protected List<WebElement> findAllAvailableWebElements(String elementListKey, String... replaceArgs) throws StopTestException { int interval = (int) Math.floor(Math.sqrt(timeout)); Wait<WebDriver> wait = new FluentWait<WebDriver>(webDriver).withTimeout(timeout, TimeUnit.SECONDS) .pollingEvery(interval, TimeUnit.SECONDS) .ignoring(NoSuchElementException.class, StaleElementReferenceException.class); try { return wait.until( ExpectedConditions.visibilityOfAllElementsLocatedBy(createBy(elementListKey, replaceArgs))); } catch (TimeoutException e) { throw new StopTestException("There was a timeout while finding the element '" + createBy(elementListKey, replaceArgs) + "'!"); } }
From source file:org.wso2.es.ui.integration.test.store.ESStoreAnonCategorySortingTestCase.java
License:Open Source License
@BeforeClass(alwaysRun = true) public void setUp() throws Exception { assetName = "Zero Asset"; super.init(); driver = new ESWebDriver(BrowserManager.getWebDriver()); wait = new WebDriverWait(driver, MAX_POLL_COUNT); currentUserName = userInfo.getUserName().split("@")[0]; currentUserPwd = userInfo.getPassword(); baseUrl = getWebAppURL();//from ww w . ja v a 2 s. c o m resourcePath = GADGET_REGISTRY_BASE_PATH + currentUserName + "/" + assetName + "/" + ASSET_VERSION; ESUtil.login(driver, baseUrl, STORE_APP, currentUserName, currentUserPwd); driver.get(baseUrl + STORE_GADGET_LIST_PAGE); //get the first element from the gadget list wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy( By.cssSelector(".assets-container section div.ctrl-wr-asset:first-child a.ast-name"))); popularAsset1 = driver .findElement(By.cssSelector(".assets-container section div.ctrl-wr-asset:first-child a.ast-name")) .getText(); driver.findElement(By.cssSelector(".assets-container section div.ctrl-wr-asset:first-child a.ast-name")) .click(); wait.until(ExpectedConditions .visibilityOfAllElementsLocatedBy(By.cssSelector("#assetp-tabs li:nth-child(2) a"))); driver.findElement(By.cssSelector("#assetp-tabs li:nth-child(2) a")).click(); driver.switchTo().frame(driver.findElement(By.id("socialIfr"))); AssetUtil.addRatingsAndReviews(driver, REVIEW_1, RATING_1); //Rating the second asset //get the first element from the gadget list driver.get(baseUrl + STORE_GADGET_LIST_PAGE); wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy( By.cssSelector(".assets-container section div.ctrl-wr-asset:nth-child(2) a.ast-name"))); popularAsset2 = driver .findElement(By.cssSelector(".assets-container section div.ctrl-wr-asset:nth-child(2) a.ast-name")) .getText(); driver.findElement(By.cssSelector(".assets-container section div.ctrl-wr-asset:nth-child(2) a.ast-name")) .click(); wait.until(ExpectedConditions .visibilityOfAllElementsLocatedBy(By.cssSelector("#assetp-tabs li:nth-child(2) a"))); driver.findElement(By.cssSelector("#assetp-tabs li:nth-child(2) a")).click(); driver.switchTo().frame(driver.findElement(By.id("socialIfr"))); AssetUtil.addRatingsAndReviews(driver, REVIEW_2, RATING_2); //navigate to publisher and add and publish a new gadget to support sort by created time driver.get(baseUrl + PUBLISHER_URL); AssetUtil.addNewAsset(driver, baseUrl, ASSET_TYPE, assetName, ASSET_VERSION, "", "", ""); driver.findElementPoll(By.linkText(assetName), MAX_POLL_COUNT); driver.findElement(By.linkText(assetName)).click(); AssetUtil.publishAssetToStore(driver, assetName); driver.get(baseUrl + PUBLISHER_LOGOUT_URL); //navigate to store and wait for the new gadget to be visible in store driver.get(baseUrl + STORE_GADGET_LIST_PAGE); driver.findElementPoll(By.linkText(assetName), MAX_POLL_COUNT); }
From source file:org.wso2.es.ui.integration.test.store.ESStoreAnonCategorySortingTestCase.java
License:Open Source License
@Test(groups = "wso2.es.store", description = "Testing sorting on alphabetical order") public void testStoreSortOnAlphabeticalOrder() throws Exception { driver.get(baseUrl + STORE_GADGET_LIST_PAGE); //sort by alphabetical order wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.id("sortDropdown"))); driver.findElement(By.cssSelector("#sortDropdown > img")).click(); driver.findElement(By.cssSelector("#ul-sort-assets li:nth-child(2) a")).click(); wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy( By.cssSelector(".assets-container section div.ctrl-wr-asset:first-child a.ast-name"))); assertEquals(assetName,//from w w w. j a v a2 s .co m driver.findElement( By.cssSelector(".assets-container section div.ctrl-wr-asset:first-child a.ast-name")) .getText(), "Alphabetical Sort failed"); assertEquals(WSO2_JIRA, driver.findElement( By.cssSelector(".assets-container section div.ctrl-wr-asset:nth-child(2) a.ast-name")) .getText(), "Alphabetical Sort failed"); }