List of usage examples for org.openqa.selenium.support.ui ExpectedConditions visibilityOf
public static ExpectedCondition<WebElement> visibilityOf(final WebElement element)
From source file:org.kie.wb.selenium.util.Waits.java
License:Apache License
public static WebElement elementPresent(WebElement element) { return new WebDriverWait(GrapheneUtil.getDriver(), DEFAULT_TIMEOUT) .until(ExpectedConditions.visibilityOf(element)); }
From source file:org.nuxeo.functionaltests.pages.AbstractPage.java
License:Open Source License
/** * Returns the fancy box content web element * * @since 5.7//from w w w .ja v a 2 s . co m */ public WebElement getFancyBoxContent() { // make sure the fancybox content is loaded WebElement fancyBox = findElementWithTimeout(By.id("fancybox-content")); WebDriverWait wait = new WebDriverWait(driver, AbstractTest.LOAD_TIMEOUT_SECONDS); wait.until(ExpectedConditions.visibilityOf(fancyBox)); return fancyBox; }
From source file:org.nuxeo.functionaltests.pages.workspace.WorkspaceHomePage.java
License:Apache License
public WorkspaceRepositoryPage goToRepository() { Locator.getFluentWait().ignoring(NoSuchElementException.class) .until(ExpectedConditions.visibilityOf(breadcrumbForm)); DocumentBasePage.makeBreadcrumbUsable(driver); WebElement first = breadcrumbForm.findElements(By.className("jsBreadcrumbActionList")).get(0) .findElement(By.tagName("li")); Locator.scrollToElement(first); Locator.getFluentWait().until(ExpectedConditions.elementToBeClickable(first)); first.click();/*w w w. j a va 2 s . c om*/ Locator.findElementWaitUntilEnabledAndClick(first, By.linkText("Repository")); return asPage(WorkspaceRepositoryPage.class); }
From source file:org.openecomp.sdc.ci.tests.execute.sanity.Onboard.java
License:Open Source License
private String onboardVNF(String filepath, String vnfFile) throws Exception, Throwable { extendTest.log(LogStatus.INFO, String.format("going to onboard the VNF %s......", vnfFile)); System.out.println(String.format("going to onboard the VNF %s......", vnfFile)); OnboardingUtils.createVendorLicense(getUser()); String vspName = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser()); GeneralUIUtils.getWebButton("repository-icon").click(); extendTest.log(LogStatus.INFO, String.format("searching for onboarded %s", vnfFile)); GeneralUIUtils.getWebElementWaitForVisible("onboarding-search").sendKeys(vspName); AssertJUnit.assertTrue(GeneralPageElements.checkElementsCountInTable(2)); List<WebElement> elemenetsFromTable = GeneralPageElements.getElemenetsFromTable(); GeneralUIUtils.waitForLoader();/*from www . j a v a2s .com*/ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30); WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1))); findElement.click(); GeneralUIUtils.waitForLoader(); extendTest.log(LogStatus.INFO, String.format("going to import %s......", vnfFile.substring(0, vnfFile.indexOf(".")))); GeneralUIUtils.getWebElementWaitForVisible("import-csar").click(); GeneralUIUtils.getWebButton("create/save").click(); GeneralUIUtils.waitForLoaderOnboarding(); WebDriverWait wait2 = new WebDriverWait(GeneralUIUtils.getDriver(), 2 * 60); wait2.until(ExpectedConditions.visibilityOfElementLocated(By .xpath("//*[@data-tests-id='" + DataTestIdEnum.LifeCyleChangeButtons.CHECK_IN.getValue() + "']"))); extendTest.log(LogStatus.PASS, String.format("succeeded to import %s......", vnfFile.substring(0, vnfFile.indexOf(".")))); return vspName; }
From source file:org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest.java
License:Open Source License
public void loginToSystem(UserRoleEnum role) { WebDriver driver = GeneralUIUtils.getDriver(); WebDriverWait wait = new WebDriverWait(driver, 30); wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//*[@method='" + "post" + "']")))); WebElement userIdTextbox = GeneralUIUtils.waitForElementVisibility(By.name("userId")); userIdTextbox.sendKeys(role.getUserId()); WebElement passwordTextbox = GeneralUIUtils.waitForElementVisibility(By.name("password")); passwordTextbox.sendKeys("123123a"); wait.until(ExpectedConditions//w w w . j a va 2 s.c om .elementToBeClickable(driver.findElement(By.xpath("//*[@value='" + "Submit" + "']")))).click(); GeneralUIUtils.waitForLoader(); }
From source file:org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils.java
License:Open Source License
public static WebElement waitForElementVisibility(By by, int duration) { WebDriverWait wait = new WebDriverWait(driver, duration); return wait.until(ExpectedConditions.visibilityOf(driver.findElement(by))); }
From source file:org.openmrs.steps.FindPatientPageSteps.java
License:Open Source License
private void waitForVisibility(WebElement elt) { WebDriverWait wait = new WebDriverWait(driver, 10); wait.until(ExpectedConditions.visibilityOf(elt)); }
From source file:org.opennms.smoketest.OpenNMSSeleniumTestCase.java
License:Open Source License
protected void clickMenuItem(final String menuItemText, final String submenuItemText, final String submenuItemHref) { final Actions action = new Actions(m_driver); final WebElement menuElement; if (menuItemText.startsWith("name=")) { final String menuItemName = menuItemText.replaceFirst("name=", ""); menuElement = findElementByName(menuItemName); } else {/*from ww w .j a v a 2 s .c om*/ menuElement = findElementByXpath("//a[contains(text(), '" + menuItemText + "')]"); } action.moveToElement(menuElement, 2, 2).perform(); final WebElement submenuElement; if (submenuItemText != null) { if (submenuItemHref == null) { submenuElement = findElementByXpath("//a[contains(text(), '" + submenuItemText + "')]"); } else { submenuElement = findElementByXpath( "//a[@href='" + submenuItemHref + "' and contains(text(), '" + submenuItemText + "')]"); } } else { submenuElement = null; } if (submenuElement == null) { // no submenu given, just click the main element // wait until the element is visible, not just present in the DOM wait.until(ExpectedConditions.visibilityOf(menuElement)); menuElement.click(); } else { // we want a submenu item, click it instead // wait until the element is visible, not just present in the DOM wait.until(ExpectedConditions.visibilityOf(submenuElement)); submenuElement.click(); } }
From source file:org.wso2.iot.integration.ui.pages.graphs.GraphHandler.java
License:Open Source License
/** * This method is to get all the elements of graphs and store in a Hash map. * This simplifies iterating through the DOM every time finding for an element when having multiple graphs. *//*www . j a va 2 s . c o m*/ public Map<String, Graph> getGraphMap() { HashMap<String, Graph> graphMap = new HashMap<>(); WebDriverWait wait = new WebDriverWait(driver, UIUtils.webDriverTimeOut); wait.until(ExpectedConditions.visibilityOf( driver.findElement(By.xpath(uiElementMapper.getElement("iot.stat.graph.wrapper.xpath"))))); List<WebElement> graphs = driver .findElements(By.xpath(uiElementMapper.getElement("iot.stat.graph.wrapper.xpath"))); for (WebElement e : graphs) { Graph g = new Graph(); String key = e.getAttribute("id").split("-")[1]; g.setGraphId(key.toLowerCase().replace(" ", "")); String xAxis = e.findElement(By.xpath(uiElementMapper.getElement("iot.stat.graph.xAxis.xpath"))) .getText(); g.setxAxis(xAxis); String yAxis = e.findElement(By.xpath("//*[contains(@id, \"y_axis-" + key + "\")]")).getText(); g.setyAxis(yAxis); String legend = e.findElement(By.xpath("//*[contains(@id, \"legend-" + key + "\")]")) .findElement(By.tagName("span")).getText(); g.setLegend(legend); graphMap.put(key, g); } return graphMap; }
From source file:org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceTypeViewPage.java
License:Open Source License
/** * This method verifies that the pop up modal for inserting a name for device is present. * @return : True if the Modal pop up is displayed. False otherwise. *//*from ww w.j a va 2s . c o m*/ public boolean isPopUpPresent() throws InterruptedException { WebElement createInstanceBtn = driver.findElement( By.xpath(uiElementMapper.getElement("iot.sample.connectedcup.createInstanceBtn.xpath"))); createInstanceBtn.click(); WebDriverWait wait = new WebDriverWait(driver, UIUtils.webDriverTimeOut); wait.until(ExpectedConditions.visibilityOf( driver.findElement(By.xpath(uiElementMapper.getElement("iot.sample.modal.popup.xpath"))))); return driver.findElement(By.xpath(uiElementMapper.getElement("iot.sample.modal.popup.xpath"))) .isDisplayed(); }