List of usage examples for org.openqa.selenium Keys ENTER
Keys ENTER
To view the source code for org.openqa.selenium Keys ENTER.
Click Source Link
From source file:org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage.java
License:Open Source License
public static void defineTagsList(ComponentReqDetails resource, String[] resourceTags) { List<String> taglist = new ArrayList<String>(); ;//w ww.ja v a 2 s . c o m WebElement resourceTagsTextbox = getTagsField(); for (String tag : resourceTags) { resourceTagsTextbox.clear(); resourceTagsTextbox.sendKeys(tag); GeneralUIUtils.sleep(1000); resourceTagsTextbox.sendKeys(Keys.ENTER); taglist.add(tag); } resource.setTags(taglist); }
From source file:org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils.java
License:Open Source License
public static void defineTagsList(ResourceReqDetails resource, String[] resourceTags) { List<String> taglist = new ArrayList<String>(); ;//from w w w .ja v a2 s.c om WebElement resourceTagsTextbox = getWebElementWaitForVisible("i-sdc-tag-input"); for (String tag : resourceTags) { resourceTagsTextbox.clear(); resourceTagsTextbox.sendKeys(tag); resourceTagsTextbox.sendKeys(Keys.ENTER); taglist.add(tag); // waitForElements(By.className("sdc-loader"), 250, 15000); } }
From source file:org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils.java
License:Open Source License
public static void defineTagsList(ServiceReqDetails service, String[] serviceTags) { List<String> taglist = new ArrayList<String>(); ;//from w w w .j a v a 2 s. co m WebElement serviceTagsTextbox = GeneralUIUtils.getWebElementWaitForVisible("i-sdc-tag-input"); for (String tag : serviceTags) { serviceTagsTextbox.clear(); serviceTagsTextbox.sendKeys(tag); serviceTagsTextbox.sendKeys(Keys.ENTER); taglist.add(tag); } taglist.add(0, service.getName()); service.setTags(taglist); }
From source file:org.openmrs.module.mirebalais.smoke.pageobjects.AbstractPageObject.java
License:Open Source License
public void hitEnterKey() { driver.switchTo().activeElement().sendKeys(Keys.ENTER); }
From source file:org.openmrs.module.mirebalais.smoke.pageobjects.AbstractPageObject.java
License:Open Source License
public void hitEnterKey(By elementId) { driver.findElement(elementId).sendKeys(Keys.ENTER); }
From source file:org.openmrs.module.mirebalais.smoke.pageobjects.forms.DispenseMedicationForm.java
License:Open Source License
private void autocompleteMedicationWith(String name) throws InterruptedException { WebElement autocomplete = driver.findElement(medicationNameAutocompleteInput); autocomplete.sendKeys(name);/*w ww. jav a 2 s . co m*/ wait5seconds.until(firstResultIsDisplayed); autocomplete.sendKeys(Keys.DOWN); autocomplete.sendKeys(Keys.ENTER); }
From source file:org.opennms.smoketest.ProvisioningNewUIIT.java
License:Open Source License
/** * Test requisition UI.//from ww w . j av a 2 s .c o m * * @throws Exception the exception */ @Test public void testRequisitionUI() throws Exception { setImplicitWait(2, TimeUnit.SECONDS); // Add a new requisition clickId("add-requisition", false); wait.until(ExpectedConditions .visibilityOfElementLocated(By.cssSelector("form.bootbox-form > input.bootbox-input"))); enterText(By.cssSelector("form.bootbox-form > input.bootbox-input"), REQUISITION_NAME); findElementByXpath("//div/button[text()='OK']").click(); wait.until( ExpectedConditions.visibilityOfElementLocated(By.xpath("//td[text()='" + REQUISITION_NAME + "']"))); // Edit the foreign source final String editForeignSourceButton = "button.btn[uib-tooltip='Edit detectors and policies of the " + REQUISITION_NAME + " Requisition']"; wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector(editForeignSourceButton))).click(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("ul.nav-tabs > li > a.nav-link"))); wait.until(ExpectedConditions.visibilityOfElementLocated( By.xpath("//h4[text()='Foreign Source Definition for Requisition " + REQUISITION_NAME + "']"))); // Add a detector wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("add-detector"))); clickId("add-detector", false); wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("form[name='detectorForm']"))); enterText(By.xpath("//form[@name='detectorForm']//input[@ng-model='detector.name']"), NODE_SERVICE); enterText(By.xpath("//form[@name='detectorForm']//input[@ng-model='detector.class']"), "HTTP"); findElementByXpath( "//form[@name='detectorForm']//ul[contains(@class, 'dropdown-menu')]/li/a/strong[text()='HTTP']") .click(); waitForDropdownClose(); // Add a parameter to the detector clickId("add-detector-parameter", false); wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("input[name='paramName']"))); enterText(By.cssSelector("input[name='paramName']"), "po"); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@title='port']"))).click(); enterText(By.cssSelector("input[name='paramValue']"), "8980"); //enterText(By.cssSelector("input[name='paramValue']"), Keys.ENTER); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("save-detector"))).click(); waitForModalClose(); enterText(By.cssSelector("input[placeholder='Search/Filter Detectors'][ng-model='filters.detector']"), "HTTP-8980"); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//td[text()='" + NODE_SERVICE + "']"))); // Add a policy to the detector findElementByCss("#tab-policies .ng-binding").click(); clickId("add-policy", false); findElementByCss("form[name='policyForm']"); enterText(By.cssSelector("input#name"), "No IPs"); enterText(By.cssSelector("input#clazz"), "Match IP Interface"); enterText(By.cssSelector("input#clazz"), Keys.ENTER); enterText(By.xpath("(//input[@name='paramValue'])[1]"), "DO_NOT_PERSIST"); enterText(By.xpath("(//input[@name='paramValue'])[1]"), Keys.ENTER); enterText(By.xpath("(//input[@name='paramValue'])[2]"), "NO_PARAMETERS"); enterText(By.xpath("(//input[@name='paramValue'])[2]"), Keys.ENTER); clickId("save-policy", false); waitForModalClose(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//td[text()='No IPs']"))); // Save foreign source definition clickId("save-foreign-source", false); wait.until(ExpectedConditions .not(ExpectedConditions.visibilityOfElementLocated(By.id("save-foreign-source")))); // Go to the Requisition page clickId("go-back", false); wait.until(ExpectedConditions.visibilityOfElementLocated( By.xpath("//h4[text()='Requisition " + REQUISITION_NAME + " (0 defined, 0 deployed)']"))); // Add node to a requisition clickId("add-node", false); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("nodeLabel"))).clear(); enterText(By.id("nodeLabel"), NODE_LABEL); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("foreignId"))).clear(); enterText(By.id("foreignId"), NODE_FOREIGNID); saveNode(); // Add an IP Interface clickId("tab-interfaces", false); findElementById("add-interface").click(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("form[name='intfForm']"))); final By ipaddrBy = By.cssSelector("input#ipAddress"); wait.until(ExpectedConditions.visibilityOfElementLocated(ipaddrBy)); enterText(ipaddrBy, NODE_IPADDR); // Add a service to the IP Interface findElementById("add-service").click(); final By xpath = By.cssSelector("input[name='serviceName']"); wait.until(ExpectedConditions.visibilityOfElementLocated(xpath)); Thread.sleep(100); enterText(xpath, "HTTP-89"); findElementByXpath("//a[@title='HTTP-8980']/strong").click(); // Save the IP interface clickId("save-interface", false); wait.until(ExpectedConditions.visibilityOfElementLocated( By.xpath("//td[contains(@class,'ng-binding') and text()='" + NODE_IPADDR + "']"))); // Add an asset to the node clickId("tab-assets", false); clickId("add-asset", false); findElementByCss("form[name='assetForm']"); enterText(By.id("asset-name"), "countr"); findElementByXpath("//a[@title='country']/strong").click(); enterText(By.id("asset-value"), "USA"); clickId("save-asset", false); waitForModalClose(); // Add a category to the node clickId("tab-categories", false); clickId("add-category", false); Thread.sleep(100); enterText(By.cssSelector("input[name='categoryName']"), NODE_CATEGORY); findElementByXpath("//a[@title='" + NODE_CATEGORY + "']/strong").click(); saveNode(); // Go to the requisition page clickId("go-back", false); wait.until(ExpectedConditions.visibilityOfElementLocated( By.xpath("//td[contains(@class,'ng-binding') and text()='" + NODE_LABEL + "']"))); wait.until(ExpectedConditions.visibilityOfElementLocated( By.xpath("//td[contains(@class,'ng-binding') and text()='" + NODE_FOREIGNID + "']"))); wait.until(ExpectedConditions.visibilityOfElementLocated( By.xpath("//p[contains(@class,'ng-binding') and text()='" + NODE_IPADDR + " (P)']"))); // Synchronize the requisition clickId("synchronize", false); wait.until(ExpectedConditions .visibilityOfElementLocated(By.cssSelector(".modal-dialog button.btn.btn-success"))); WebElement modal = findModal(); modal.findElement(By.xpath("//div/button[text()='Yes']")).click(); waitForModalClose(); wait.until(new WaitForNodesInRequisition(REQUISITION_NAME, 1)); wait.until(new WaitForNodesInDatabase(REQUISITION_NAME, 1)); clickId("refresh", false); clickId("refreshDeployedStats", false); wait.until(ExpectedConditions.visibilityOfElementLocated( By.xpath("//h4[text()='Requisition " + REQUISITION_NAME + " (1 defined, 1 deployed)']"))); // Go to the requisitions page clickId("go-back", false); // Wait until the node has been added to the database, using the ReST API m_driver.get(getBaseUrl() + "opennms/rest/nodes/" + REQUISITION_NAME + ":" + NODE_FOREIGNID + "/ipinterfaces/" + NODE_IPADDR + "/services/ICMP"); m_driver.manage().timeouts().implicitlyWait(2000, TimeUnit.MILLISECONDS); try { for (int i = 0; i < 30; i++) { try { final WebElement e = m_driver .findElement(By.xpath("//service/serviceType/name[text()='ICMP']")); if (e != null) { break; } } catch (Exception e) { } m_driver.navigate().refresh(); } } finally { m_driver.manage().timeouts().implicitlyWait(LOAD_TIMEOUT, TimeUnit.MILLISECONDS); } // Open the nodes list page m_driver.get(getBaseUrl() + "opennms/"); clickMenuItem("Info", "Nodes", "element/nodeList.htm"); try { // Disable implicitlyWait m_driver.manage().timeouts().implicitlyWait(0, TimeUnit.MILLISECONDS); // If this is the only node on the system, we'll be sent directly to its node details page. findElementByXpath("//h3[text()='Availability']"); } catch (NoSuchElementException e) { // If there are multiple nodes, we will be on the node list page, click through to the node findElementByLink(NODE_LABEL).click(); } finally { // Restore the implicitlyWait timeout m_driver.manage().timeouts().implicitlyWait(LOAD_TIMEOUT, TimeUnit.MILLISECONDS); } wait.until(ExpectedConditions.elementToBeClickable(By.linkText("ICMP"))); findElementByXpath("//a[contains(@href, 'element/interface.jsp') and text()='" + NODE_IPADDR + "']"); findElementByLink("HTTP-8980"); }
From source file:org.opennms.smoketest.QuickAddNodeIT.java
License:Open Source License
@Test public void testQuickAddNode() throws Exception { adminPage();// w w w. j a v a 2s . c o m clickMenuItem("name=nav-admin-top", "Quick-Add Node", "admin/ng-requisitions/app/quick-add-node.jsp"); Thread.sleep(5000); long end = System.currentTimeMillis() + LOAD_TIMEOUT; do { // Basic fields findElementByCss("input#foreignSource"); enterTextAutocomplete(By.id("foreignSource"), REQUISITION_NAME); enterText(By.id("ipAddress"), NODE_IPADDR); enterText(By.id("nodeLabel"), NODE_LABEL); } while (!textFieldsReady() && System.currentTimeMillis() < end); // Add a category to the node findElementById("add-category").click(); findElementByCss("input[name='categoryName'"); enterTextAutocomplete(By.cssSelector("input[name='categoryName']"), NODE_CATEGORY, Keys.ENTER); wait.until(ExpectedConditions.elementToBeClickable(By.id("provision"))).click(); wait.until(ExpectedConditions .visibilityOfElementLocated(By.cssSelector(".modal-dialog button[data-bb-handler='main']"))) .click(); wait.until(new WaitForNodesInDatabase(1)); }
From source file:org.opennms.smoketest.QuickAddNodeIT.java
License:Open Source License
protected WebElement enterTextAutocomplete(final By selector, final CharSequence... text) throws InterruptedException { final WebElement element = m_driver.findElement(selector); element.clear();/*w w w. j av a 2 s . com*/ element.click(); Thread.sleep(500); element.sendKeys(text); Thread.sleep(100); element.sendKeys(Keys.ENTER); Thread.sleep(100); try { setImplicitWait(5, TimeUnit.SECONDS); final List<WebElement> matching = m_driver.findElements(By.cssSelector("a[title='" + text + "']")); if (!matching.isEmpty()) { findElementByCss("a[title='" + text + "']").click(); } } finally { setImplicitWait(); } return element; }
From source file:org.opennms.smoketest.SearchPageIT.java
License:Open Source License
@Test public void testSearchMacAddress() throws Exception { final WebElement maclike = enterText(By.cssSelector("input[name='maclike']"), "0"); maclike.sendKeys(Keys.ENTER); findElementByXpath("//div[@id='content']/ol/li[text()='Node List']"); findElementByXpath("//h3[@class='panel-title']/span[text()='Nodes']"); }