List of usage examples for org.openqa.selenium Keys RETURN
Keys RETURN
To view the source code for org.openqa.selenium Keys RETURN.
Click Source Link
From source file:de.iteratec.iteraplan.webtests.poc.page.attributesGroup.AttributesGroupEditElementPage.java
License:Open Source License
/** * Adds a list with attributes to an attributes group * @param attr list with attributes/*from w w w. ja v a 2 s .c o m*/ * @return the current page */ public AttributesGroupEditElementPage addAttributes(List<String> attr) { int counter = 1; for (String str : attr) { String respTextXPath = "//*[@id=\"componentModel.containedAttributeTypesModel.htmlId\"]/tbody/tr[" + counter + "]/td[2]/input"; By respTextLocator = By.xpath(respTextXPath); driver.findElement(respTextLocator).click(); driver.findElement(respTextLocator).sendKeys(str); /* * The usage of the wait construct is bad. This should be replaced By conditional waiting. It is used at this place, * because the popup list must be loaded from the server and after THAT an entry can be selected * will be fixed soon (hopefully) */ synchronized (driver) { try { driver.wait(2000); } catch (InterruptedException e) { e.printStackTrace(); } } driver.findElement(respTextLocator).sendKeys(Keys.ARROW_DOWN); driver.findElement(respTextLocator).sendKeys(Keys.RETURN); synchronized (driver) { try { driver.wait(2000); } catch (InterruptedException e) { e.printStackTrace(); } } clickAddAttribute(); counter++; } return this; }
From source file:de.iteratec.iteraplan.webtests.poc.page.buildingblock.BuildingBlockEditElementPage.java
License:Open Source License
/** * This method is used to set a value for a IS in a combo box. The difference between this method and the setISAttribute method is, * that setISAttribute doesn't have the logic to select an entry from a popup. This popup is shown, if an accepted value is insert in the combo box. * @param attributeGroup name of attribute group * @param attributeName name of attribute * @param attributeValue the value of attribute * @return the Building Block New Element Page *//*w w w.ja va2 s. com*/ public BuildingBlockEditElementPage setISAttributeFromComboBox(String attributeGroup, String attributeName, String attributeValue) { //first click the attributes tab driver.findElement(attributesTabLocator).click(); //click the attributes tab String attributeGroupXpath = "//a/text()[contains(., '" + attributeGroup + "')]/.."; By attributesGroupLocator = By.xpath(attributeGroupXpath); driver.findElement(attributesGroupLocator).click(); //find the specific label by the attributes name String labelXpath = "//*/label/a[contains(text(), '" + attributeName + "')]/../../label/..//input"; By inputLocator = By.xpath(labelXpath); driver.findElement(inputLocator).click(); driver.findElement(inputLocator).sendKeys(attributeValue); /* * These wait conditions are bad. But there must be a waiting time for showing the popup and selecting an item * This could be solved much better if there are conditional waitings ("is popup visible, otherwise wait") * Will be fixed soon (hopefully) * */ WaitUtils.wait(2000); driver.findElement(inputLocator).sendKeys(Keys.ARROW_DOWN); WaitUtils.wait(2000); driver.findElement(inputLocator).sendKeys(Keys.RETURN); return this; }
From source file:de.iteratec.iteraplan.webtests.poc.page.buildingblock.BuildingBlockEditElementPage.java
License:Open Source License
/** * Sets a parent Business Object for a new Business Object * @param parent//from w w w .ja v a2 s. c o m * @return current building block new element page */ public BuildingBlockEditElementPage setParentBO(String parent) { //first clear the textfield driver.findElement(boParentLocator).clear(); driver.findElement(boParentLocator).sendKeys(parent); /* * These wait conditions are bad. But there must be a waiting time for showing the popup and selecting an item * This could be solved much better if there are conditional waitings ("is popup visible, otherwise wait") * Will be fixed soon (hopefully) * */ WaitUtils.wait(2000); driver.findElement(boParentLocator).sendKeys(Keys.ARROW_DOWN); WaitUtils.wait(2000); driver.findElement(boParentLocator).sendKeys(Keys.RETURN); return this; }
From source file:de.iteratec.iteraplan.webtests.poc.page.buildingblock.BuildingBlockEditElementPage.java
License:Open Source License
/** * Adds childs of Business Objects to a new BusinessObject * @param childs//from w w w . j ava2s. c o m * @return current building block new element page */ public BuildingBlockEditElementPage addChildBOs(List<String> childs) { int counter = 1; for (String str : childs) { String childInputXPath = "//*[@id=\"componentModel.childrenModel.htmlId\"]/tbody/tr[" + counter + "]/td[2]/input"; By childInputLocator = By.xpath(childInputXPath); driver.findElement(childInputLocator).click(); driver.findElement(childInputLocator).sendKeys(str); /* * The usage of the wait construct is bad. This should be replaced by conditional waiting. It is used at this place, * because the popup list must be loaded from the server and after THAT an entry can be selected * will be fixed soon (hopefully) */ WaitUtils.wait(2000); driver.findElement(childInputLocator).sendKeys(Keys.ARROW_DOWN); driver.findElement(childInputLocator).sendKeys(Keys.RETURN); WaitUtils.wait(2000); clickAddBOChild(); counter++; } return this; }
From source file:de.iteratec.iteraplan.webtests.poc.page.buildingblock.BuildingBlockEditElementPage.java
License:Open Source License
/** * Sets a subsystem for a Information System * This method only accepts one subsystem. It must be extended to use a list as parameter * @param sub the name of the subsystem/*from www . ja va2s . c om*/ * @return current building block new element page */ public BuildingBlockEditElementPage setContainingSubsystem(String sub) { driver.findElement(subsystemLocator).click(); driver.findElement(subsystemLocator).sendKeys(sub); /* * The usage of the wait construct is bad. This should be replaced by conditional waiting. It is used at this place, * because the popup list must be loaded from the server and after THAT an entry can be selected * will be fixed soon (hopefully) */ WaitUtils.wait(2000); driver.findElement(subsystemLocator).sendKeys(Keys.ARROW_DOWN); driver.findElement(subsystemLocator).sendKeys(Keys.RETURN); WaitUtils.wait(2000); clickAddSubsystem(); return this; }
From source file:de.iteratec.iteraplan.webtests.poc.page.interfaces.InterfacesEditElementPage.java
License:Open Source License
public InterfacesEditElementPage setLeftIS(String name) { driver.findElement(leftISLocator).clear(); driver.findElement(leftISLocator).click(); driver.findElement(leftISLocator).sendKeys(name); WaitUtils.wait(2000);/* w ww . j a v a 2 s . c o m*/ driver.findElement(leftISLocator).sendKeys(Keys.ARROW_DOWN); driver.findElement(leftISLocator).sendKeys(Keys.RETURN); WaitUtils.wait(2000); return this; }
From source file:de.iteratec.iteraplan.webtests.poc.page.interfaces.InterfacesEditElementPage.java
License:Open Source License
public InterfacesEditElementPage setRightIS(String name) { driver.findElement(rightISLocator).clear(); driver.findElement(rightISLocator).click(); driver.findElement(rightISLocator).sendKeys(name); WaitUtils.wait(2000);/*from w ww. j a v a 2 s. com*/ driver.findElement(rightISLocator).sendKeys(Keys.ARROW_DOWN); driver.findElement(rightISLocator).sendKeys(Keys.RETURN); WaitUtils.wait(2000); return this; }
From source file:Domain.Story2.java
@Test public void testSearchProduct() { driver.get("http://store.demoqa.com/"); //Clear the search form driver.findElement(By.className("search")).clear(); //Input "Magic" in the search form driver.findElement(By.className("search")).sendKeys("Magic" + Keys.RETURN); //Wait page forward to product detail page waitUntil(d -> d.findElement(By.linkText("Magic Mouse")).isDisplayed()); try {/*from ww w . jav a 2 s . c o m*/ //Find the "Magic Mouse" Product link WebElement ProductGroup = driver.findElement(By.linkText("Magic Mouse")); assertTrue(ProductGroup.isDisplayed()); } catch (NoSuchElementException nseex) { fail(); } driver.manage().deleteAllCookies(); }
From source file:edreams.PageObject.EdreamsSearchPage.java
public void search(String FromAirport, String toAirport, int numAdults, int numchilds) { System.out.println("Select flight"); driver.findElement(ManageFlightBtn).click(); System.out.println("clean From airport"); //inputFrom.clear(); driver.findElement(FromAirportTxtB).clear(); if (!FromAirport.isEmpty()) { System.err.println("add airport filter"); driver.findElement(FromAirportTxtB).sendKeys("Mad"); try {//from ww w . j av a 2 s . com Thread.sleep(5000); //wait a bit to the modal! and then press return. } catch (InterruptedException ex) { Logger.getLogger(EdreamsSearchPage.class.getName()).log(Level.SEVERE, null, ex); } driver.findElement(FromAirportTxtB).sendKeys(Keys.RETURN); driver.findElement(FromAirportTxtB).sendKeys(Keys.TAB); } System.out.println("clean From airport"); //while numAdults.. Click //while numChlds.. Click driver.findElement(By.xpath("//div[@id='pax-selector']/div/div/div/span[2]")).click(); driver.findElement(By.cssSelector("div.od-aside-button.inc")).click(); driver.findElement(By.xpath("//div[@id='pax-selector']/div/div/div[2]/div[2]/div/div[2]/div/div[3]")) .click(); driver.findElement(By.xpath("//div[@id='pax-selector']/div/div/div[2]/div[3]/div/div[2]/div/div[3]")) .click(); driver.findElement(By.xpath("//div[@id='pax-selector']/div/div/div[2]/div[3]/div/div[2]/div/div[2]")) .click(); driver.findElement(By.xpath("//div[@id='pax-selector']/div/div/div[2]/div[2]/div/div[2]/div/div[2]")) .click(); }
From source file:gov.nih.nci.firebird.selenium2.pages.investigator.annual.registration.SignAndSubmitRegistrationDialog.java
License:Open Source License
public void addEmailAddress(String emailAddress) { additionalEmailAddresses.sendKeys(emailAddress); additionalEmailAddresses.sendKeys(Keys.RETURN); }