List of usage examples for org.openqa.selenium.support.ui ExpectedConditions elementToBeClickable
public static ExpectedCondition<WebElement> elementToBeClickable(final WebElement element)
From source file:org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils.java
License:Open Source License
public static WebElement waitUntilClickableButton(String dataTestId) { WebDriverWait wait = new WebDriverWait(driver, 3 * 60); return wait.until(ExpectedConditions .elementToBeClickable(driver.findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']")))); }
From source file:org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils.java
License:Open Source License
public static WebElement getButtonByClassName(String element) { WebDriverWait wait = new WebDriverWait(driver, 3 * 60); return wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[@class='" + element + "']"))); }
From source file:org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils.java
License:Open Source License
public static void clickOnHTMLElementByDataTestId(String dataTestId) throws Exception { WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 20); StopWatch performanceMesuring = new StopWatch(); performanceMesuring.start();//from w w w . j a v a2 s .com WebElement element = wait.until( ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))); performanceMesuring.stop(); element.click(); performanceMesuring(dataTestId, performanceMesuring); }
From source file:org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils.java
License:Open Source License
public static void clickOnHTMLElementBylinkText(String linkText) throws Exception { WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 20); StopWatch performanceMesuring = new StopWatch(); performanceMesuring.start();// w w w. ja v a 2 s.co m WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.linkText(linkText))); performanceMesuring.stop(); element.click(); performanceMesuring(linkText, performanceMesuring); }
From source file:org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils.java
License:Open Source License
public static void selectResourceIcon(String resourceIcon) throws Exception { WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 10); wait.until(/* www . ja v a 2 s . c o m*/ ExpectedConditions.elementToBeClickable(By.xpath("//div[@data-tests-id='" + resourceIcon + "']"))) .click(); }
From source file:org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils.java
License:Open Source License
public static WebElement Waitfunctionforbuttons(String element, int timeout) { WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), timeout); return wait.until(ExpectedConditions.elementToBeClickable(By.xpath(element))); }
From source file:org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils.java
License:Open Source License
/** * Click on HTML element./* w ww . j a v a 2 s . co m*/ * * @param dataTestId * @throws Exception */ public static void clickOnHTMLElementByDataTestId(String dataTestId) throws Exception { WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 20); WebElement element = wait.until( ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))); element.click(); // wait.until(ExpectedConditions.elemetto) // WebElement serviceButton = // GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" // + dataTestId + "']")); // serviceButton. // serviceButton.click(); }
From source file:org.openmrs.reference.page.AppointmentBlocksPage.java
License:Mozilla Public License
public void selectLocation(String location) { // a wait might be needed if there are many elements to load in the dropdown menu waiter.until(ExpectedConditions.elementToBeClickable(LOCATION)); selectFrom(LOCATION, location);//w ww .ja v a2s . c o m clickOn(LOCATION); }
From source file:org.opennms.smoketest.AddNodePageIT.java
License:Open Source License
@Test public void testAddNodePage() throws Exception { // Visit the provisioning page provisioningPage();/* w w w . j av a 2s. com*/ // Add a requisition called REQUISITION_NAME findElementByXpath("//div/button[contains(@ng-click,'add')]").click(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(".modal-dialog"))); enterText(By.xpath("//form/input[contains(@class,'bootbox-input')]"), REQUISITION_NAME); findElementByXpath("//div/button[text()='OK']").click(); wait.until( ExpectedConditions.visibilityOfElementLocated(By.xpath("//td[text()='" + REQUISITION_NAME + "']"))); // Edit the requisition findElementByXpath("//td[text()='" + REQUISITION_NAME + "']/../td/button[contains(@ng-click,'edit(')]") .click(); wait.until(ExpectedConditions.visibilityOfElementLocated( By.xpath("//h1[text()='There are no nodes on the " + REQUISITION_NAME + "']"))); // Synchronize the empty requisition final String syncXpath = "//div/button[contains(@ng-click,'synchronize')]"; wait.until(ExpectedConditions.elementToBeClickable(By.xpath(syncXpath))); findElementByXpath(syncXpath).click(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(".modal-dialog"))); findElementByXpath("//div/button[text()='No']").click(); wait.until(ExpectedConditions.visibilityOfElementLocated( By.xpath("//h1[text()='There are no nodes on the " + REQUISITION_NAME + "']"))); // Wait for the requisition to be synchronized Thread.sleep(5000); frontPage(); clickMenuItem("name=nav-admin-top", "Quick-Add Node", BASE_URL + "opennms/admin/node/add.htm"); // Make sure there is a Provision button on the page final WebElement submitButton = m_driver.findElement(By.cssSelector("input[type=submit][value=Provision]")); assertEquals("Provision", submitButton.getAttribute("value")); // Select our test foreign source final WebElement selectElement = m_driver.findElement(By.cssSelector("select[name=foreignSource]")); final Select sel = new Select(selectElement); sel.selectByVisibleText(REQUISITION_NAME); // Add an unreachable IP address to the requisition findElementByName("ipAddress").sendKeys(m_unreachableIp); findElementByName("nodeLabel").sendKeys("AddNodePageTest"); // Submit submitButton.click(); // Click on the Provisioning Requisitions breadcrumb findElementByLink("Provisioning Requisitions").click(); wait.until( ExpectedConditions.visibilityOfElementLocated(By.xpath("//td[text()='" + REQUISITION_NAME + "']"))); wait.until(m_requisitionUtils.new WaitForNodesInDatabase(1)); }
From source file:org.opennms.smoketest.ProvisioningIT.java
License:Open Source License
@Test public void testRequisitionUI() throws Exception { final WebElement form = waitForElement(By.xpath("//form[@name='takeAction']")); form.findElement(By.cssSelector("input[type=text][name=groupName]")).click(); form.findElement(By.cssSelector("input[type=text][name=groupName]")).sendKeys(REQUISITION_NAME); form.submit();/*from w w w . j av a2 s .c o m*/ // edit the foreign source findElementById("edit_fs_anchor_" + REQUISITION_NAME).click(); // add a detector waitForElement(By.xpath("//input[@value='Add Detector']")).click(); String detectorNode = setTreeFieldsAndSave("foreignSourceEditForm", type("name", "HTTP-8980"), select("pluginClass", "HTTP")); // set the port to 8980 waitForElement(By.xpath("//a[contains(@href, '" + detectorNode + "') and text() = '[Add Parameter]']")) .click(); setTreeFieldsAndSave("foreignSourceEditForm", select("key", "port"), type("value", "8980")); waitForElement(By.xpath("//input[@value='Done']")).click(); // add a node findElementById("edit_req_anchor_" + REQUISITION_NAME).click(); waitForElement(By.xpath("//input[@value='Add Node']")).click(); String nodeForNode = setTreeFieldsAndSave("nodeEditForm", type("nodeLabel", NODE_LABEL), type("foreignId", NODE_LABEL)); // add the node interface waitForElement(By.xpath("//a[contains(@href, '" + nodeForNode + "') and text() = '[Add Interface]']")) .click(); setTreeFieldsAndSave("nodeEditForm", type("ipAddr", "::1")); // add the interface service waitForElement(By.xpath("//a[text() = 'Add Service']")).click(); setTreeFieldsAndSave("nodeEditForm", select("serviceName", "HTTP-8980")); waitForElement(By.xpath("//input[@value='Done']")).click(); waitForElement(By.xpath("//input[@value='Synchronize']")).click(); assertTrue(wait.until(new WaitForNodesInDatabase(1))); LOG.debug("Found 1 node in the database."); // wait for the node scanning to complete Thread.sleep(5000); m_driver.get(getBaseUrl() + "opennms/element/node.jsp?node=" + REQUISITION_NAME + ":" + NODE_LABEL); waitForElement(By.xpath("//h3[text()='Availability']")); wait.until(ExpectedConditions.elementToBeClickable(By.linkText("ICMP"))); waitForElement(By.xpath("//a[contains(@href, 'element/interface.jsp') and text()='" + InetAddressUtils.normalize("::1") + "']")); }