List of usage examples for org.openqa.selenium WebElement clear
void clear();
From source file:org.auraframework.components.ui.inputTextArea.InputTextAreaUITest.java
License:Apache License
public void testTextAreaWithMultipleLinesOfText() throws Exception { open(TEST_CMP2);/*from ww w. j a v a 2 s . c o m*/ WebElement div = findDomElement(By.id("textAreaWithLabel")); WebElement input = div.findElement(By.tagName("textarea")); WebElement outputDiv = findDomElement(By.id("output")); String inputAuraId = "textAreaWithLabel"; String valueExpression = auraUITestingUtil.getValueFromCmpRootExpression(inputAuraId, "v.value"); String inputText = String.format("%s%n%s%n%s%n%s", "LINE1", "LINE2", "LINE3", "L4"); input.clear(); input.click(); input.sendKeys(inputText); input.sendKeys(Keys.ARROW_LEFT, Keys.ARROW_LEFT); String inputNewString = "L5"; input.sendKeys(inputNewString); inputText = String.format("%s%n%s%n%s%n%s", "LINE1", "LINE2", "LINE3", "L5L4"); outputDiv.click(); // to simulate tab behavior for touch browsers String actualText = (String) auraUITestingUtil.getEval(valueExpression); assertEquals("Total number of bytes with \r\n does not match", inputText.getBytes().length + 3, actualText.getBytes().length); assertEquals("Value of Input text Area shoud be updated after removing carriage return", inputText, actualText.replaceAll("(\\r)", "")); }
From source file:org.auraframework.components.ui.InputTextAreaUITest.java
License:Apache License
/** * Test Case for W-1731003//w ww . j a v a 2 s .com * ui:inputTextArea throws error when value is changed */ public void testInputTextAreaWithLabel() throws Exception { open(TEST_CMP); WebElement div = findDomElement(By.id("textAreaWithLabel")); WebElement input = div.findElement(By.tagName("textarea")); WebElement outputDiv = findDomElement(By.id("output")); String inputAuraId = "textAreaWithLabel"; String valueExpression = auraUITestingUtil.getValueFromCmpRootExpression(inputAuraId, "v.value"); String defExpectedValue = (String) auraUITestingUtil.getEval(valueExpression); assertEquals("Default value for inputTextArea should be the same", inputAuraId, defExpectedValue); // AndroidDriver likes to type things in all caps so modify input to accommodate. String inputText = "UPDATEDTEXT"; input.clear(); input.click(); input.sendKeys(inputText); outputDiv.click(); // to simulate tab behavior for touch browsers String actualText = (String) auraUITestingUtil.getEval(valueExpression); assertEquals("Value of Input text Area shoud be updated", inputText, actualText); }
From source file:org.auraframework.components.ui.InputTextUITest.java
License:Apache License
/** * Test Case for W-1689213//from w ww .j ava2 s . co m */ public void testInputTextWithLabel() throws Exception { open(TEST_CMP); WebElement div = findDomElement(By.id("inputwithLabel")); WebElement input = div.findElement(By.tagName("input")); WebElement outputDiv = findDomElement(By.id("output")); String inputAuraId = "inputwithLabel"; String valueExpression = auraUITestingUtil.getValueFromCmpRootExpression(inputAuraId, "v.value"); String defExpectedValue = (String) auraUITestingUtil.getEval(valueExpression); assertEquals("Default value should be the same", inputAuraId, defExpectedValue); // AndroidDriver likes to type things in all caps so modify input to accommodate. String inputText = "UPDATEDTEXT"; input.clear(); input.click(); input.sendKeys(inputText); outputDiv.click(); // to simulate tab behavior for touch browsers String actualText = (String) auraUITestingUtil.getEval(valueExpression); assertEquals("Value of Input text shoud be updated", inputText, actualText); }
From source file:org.auraframework.components.ui.LocalizationAppUITest.java
License:Apache License
@ExcludeBrowsers({ BrowserType.IE9, BrowserType.IE10, BrowserType.SAFARI, BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD, BrowserType.IPHONE }) public void testDateComponents() throws Exception { open(URL);//from w w w .java2s.co m //initial load WebElement elementInput = findDomElement(By.cssSelector("input[class~='uiInputDate']")); WebElement elementoutput = findDomElement(By.cssSelector("span[class~='uiOutputDate']")); assertEquals("InputDate component rendered with wrong value", "Sep 23, 2004", elementInput.getAttribute("value")); assertEquals("outputDate component rendered with wrong value", "Sep 23, 2004", elementoutput.getText()); //Tab out elementInput.click(); elementInput.clear(); elementInput.sendKeys("Sep 23, 2005"); auraUITestingUtil.pressTab(elementInput); assertEquals("InputDate component rendered with wrong value", "Sep 23, 2005", elementInput.getAttribute("value")); assertEquals("outputDate component rendered with wrong value", "Sep 23, 2005", elementoutput.getText()); //Submit click elementInput.click(); elementInput.clear(); elementInput.sendKeys("Sep 23, 2006"); WebElement elementButton = findDomElement(By.cssSelector("button[title~='Date']")); elementButton.click(); assertEquals("InputDate component rendered with wrong value", "Sep 23, 2006", elementInput.getAttribute("value")); assertEquals("outputDate component rendered with wrong value", "Sep 23, 2006", elementoutput.getText()); }
From source file:org.auraframework.components.ui.LocalizationAppUITest.java
License:Apache License
@ExcludeBrowsers({ BrowserType.IE9, BrowserType.IE10, BrowserType.SAFARI, BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD, BrowserType.IPHONE }) public void testDateTimeComponents() throws Exception { open(URL);/*from ww w .j a v a 2 s. c o m*/ //initial load WebElement elementInput = findDomElement(By.cssSelector("input[class~='uiInputDateTime']")); WebElement elementoutput = findDomElement(By.cssSelector("span[class~='uiOutputDateTime']")); assertEquals("InputDateTime component rendered with wrong value", "Oct 23, 2004 4:30:00 PM", elementInput.getAttribute("value")); assertEquals("outputDateTime component rendered with wrong value", "Oct 23, 2004 4:30:00 PM", elementoutput.getText()); //Tab out elementInput.click(); elementInput.clear(); elementInput.sendKeys("Oct 23, 2005 9:30:00 AM"); auraUITestingUtil.pressTab(elementInput); assertEquals("InputDateTime component rendered with wrong value", "Oct 23, 2005 9:30:00 AM", elementInput.getAttribute("value")); assertEquals("outputDateTime component rendered with wrong value", "Oct 23, 2005 9:30:00 AM", elementoutput.getText()); //Submit click elementInput.click(); elementInput.clear(); elementInput.sendKeys("Oct 23, 2006 9:30:00 AM"); WebElement elementButton = findDomElement(By.cssSelector("button[title~='DateTime']")); elementButton.click(); assertEquals("InputDateTime component rendered with wrong value", "Oct 23, 2006 9:30:00 AM", elementInput.getAttribute("value")); assertEquals("outputDateTime component rendered with wrong value", "Oct 23, 2006 9:30:00 AM", elementoutput.getText()); }
From source file:org.auraframework.components.ui.LocalizationAppUITest.java
License:Apache License
@ExcludeBrowsers({ BrowserType.IE9, BrowserType.IE10, BrowserType.SAFARI, BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD, BrowserType.IPHONE }) public void testNumberComponents() throws Exception { open(URL);/* ww w . j a v a 2 s . c o m*/ //initial load WebElement elementInput = findDomElement(By.cssSelector("input[class~='uiInputNumber']")); WebElement elementoutput = findDomElement(By.cssSelector("span[class~='uiOutputNumber']")); assertEquals("InputNumber component rendered with wrong value", "411", elementInput.getAttribute("value")); assertEquals("outputNumber component rendered with wrong value", "411", elementoutput.getText()); //Tab out elementInput.click(); elementInput.clear(); elementInput.sendKeys("511"); auraUITestingUtil.pressTab(elementInput); assertEquals("InputNumber component rendered with wrong value", "511", elementInput.getAttribute("value")); assertEquals("outputNumber component rendered with wrong value", "511", elementoutput.getText()); //Submit click elementInput.click(); elementInput.clear(); elementInput.sendKeys("611"); WebElement elementButton = findDomElement(By.cssSelector("button[title~='Number']")); elementButton.click(); assertEquals("InputNumber component rendered with wrong value", "611", elementInput.getAttribute("value")); assertEquals("outputNumber component rendered with wrong value", "611", elementoutput.getText()); }
From source file:org.auraframework.components.ui.LocalizationAppUITest.java
License:Apache License
@ExcludeBrowsers({ BrowserType.IE9, BrowserType.IE10, BrowserType.SAFARI, BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD, BrowserType.IPHONE }) public void testPercentComponents() throws Exception { open(URL);//from w w w .j ava 2 s . c o m //initial load WebElement elementInput = findDomElement(By.cssSelector("input[class~='uiInputPercent']")); WebElement elementoutput = findDomElement(By.cssSelector("span[class~='uiOutputPercent']")); assertEquals("InputPercent component rendered with wrong value", "1,235%", elementInput.getAttribute("value")); assertEquals("outputPercent component rendered with wrong value", "1,235%", elementoutput.getText()); //Tab out elementInput.click(); elementInput.clear(); elementInput.sendKeys(".2235"); auraUITestingUtil.pressTab(elementInput); assertEquals("InputPercent component rendered with wrong value", ".2235", elementInput.getAttribute("value")); assertEquals("outputPercent component rendered with wrong value", "22%", elementoutput.getText()); //Submit click elementInput.click(); elementInput.clear(); elementInput.sendKeys("1.2235"); WebElement elementButton = findDomElement(By.cssSelector("button[title~='Percent']")); elementButton.click(); assertEquals("InputPercent component rendered with wrong value", "1.2235", elementInput.getAttribute("value")); assertEquals("outputPercent component rendered with wrong value", "122%", elementoutput.getText()); }
From source file:org.auraframework.components.ui.LocalizationAppUITest.java
License:Apache License
@ExcludeBrowsers({ BrowserType.IE9, BrowserType.IE10, BrowserType.SAFARI, BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD, BrowserType.IPHONE }) public void testCurrencyComponents() throws Exception { open(URL);//from w ww. j a va2s .c o m //initial load WebElement elementInput = findDomElement( By.cssSelector("span[id='MyCurrency'] > input[class~='uiInputNumber']")); WebElement elementoutput = findDomElement(By.cssSelector("span[class~='uiOutputCurrency']")); assertEquals("InputCurrency component rendered with wrong value", "$123,456.79", elementInput.getAttribute("value")); assertEquals("outputCurrency component rendered with wrong value", "$123,456.79", elementoutput.getText()); //Tab out elementInput.click(); elementInput.clear(); elementInput.sendKeys("123456"); auraUITestingUtil.pressTab(elementInput); assertEquals("InputCurrency component rendered with wrong value", "123456", elementInput.getAttribute("value")); assertEquals("outputCurrency component rendered with wrong value", "$123,456.00", elementoutput.getText()); //Submit click elementInput.click(); elementInput.clear(); elementInput.sendKeys("123.456"); WebElement elementButton = findDomElement(By.cssSelector("button[title~='Currency']")); elementButton.click(); assertEquals("InputCurrency component rendered with wrong value", "123.456", elementInput.getAttribute("value")); assertEquals("outputCurrency component rendered with wrong value", "$123.46", elementoutput.getText()); }
From source file:org.auraframework.components.ui.modalOverlay.Panel2ModalOverlayUITest.java
License:Apache License
private void verifyPressingEscOnMultipleModalDestorysModal(String locator, boolean autoFocus) throws MalformedURLException, URISyntaxException, InterruptedException { String url = APP;// w w w . j a v a 2s. co m boolean isPanel = locator.contains(PANEL_DIALOG); String errorMessage = "modal"; if (isPanel) { url += "?" + PARAM_PANEL_TYPE + "panel"; errorMessage = "panel"; } open(url); // disable autoFocus for modal 1 if (!autoFocus) { WebElement autoFocusElement = findDomElement(By.cssSelector(INPUT_AUTOFOCUS)); autoFocusElement.click(); } openPanel(); if (locator.contains(PANEL_MODAL)) { waitForModalOpen(); } else { waitForPanelDialogOpen(); WebElement fistInputElement = findDomElements(By.cssSelector(INPUT_PANELTYPE)).get(1); fistInputElement.clear(); fistInputElement.click(); fistInputElement.sendKeys("panel"); } WebElement firstModalPanel = findDomElements(By.cssSelector(locator)).get(0); assertTrue(String.format("First %s should have class active", errorMessage), firstModalPanel.getAttribute("class").contains("active")); // open second modal openPanel(2); waitForNumberOfPanels(locator, 2); WebElement secondModalPanel = findDomElements(By.cssSelector(locator)).get(1); assertFalse(String.format("First %s should have not have class active", errorMessage), firstModalPanel.getAttribute("class").contains("active")); assertTrue(String.format("Second %s should have class active", errorMessage), secondModalPanel.getAttribute("class").contains("active")); WebElement activeElement = (WebElement) auraUITestingUtil.getEval(ACTIVE_ELEMENT); activeElement.sendKeys(Keys.ESCAPE); waitForNumberOfPanels(locator, 1); assertTrue(String.format("First %s should have class active after press ESC on 2nd %s", errorMessage, errorMessage), firstModalPanel.getAttribute("class").contains("active")); activeElement = (WebElement) auraUITestingUtil.getEval(ACTIVE_ELEMENT); activeElement.sendKeys(Keys.ESCAPE); waitForNumberOfPanels(locator, 0); }
From source file:org.auraframework.integration.test.components.ui.inlineEditGrid.InlineEditGridUITest.java
License:Apache License
private void editPanelContent(WebDriver d, String newContent) { WebElement input = d.findElement(By.cssSelector(INPUT_PANEL_INPUT_SELECTOR)); input.clear(); input.sendKeys(newContent);/*ww w.j a va 2 s .c o m*/ }