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:OnlineShopTest.OnlineShopTest.java
@Test public void testWordPress() { driver.get("http://store.demoqa.com/products-page/your-account/"); driver.findElement(By.id("log")).sendKeys("Xun" + Keys.RETURN); driver.findElement(By.id("pwd")).sendKeys("tZRO7dFmGE$t2rVR" + Keys.RETURN); driver.findElement(By.id("login")).click(); By topToolBar = By.id("wp-admin-bar-my-account"); waitUntil(d -> d.findElement(topToolBar).isDisplayed()); driver.findElement(By.className("ab-icon")).click(); By wrap = By.id("wrap about-wrap"); waitUntil(d -> d.findElement(wrap).isDisplayed()); try {// w w w.j a v a 2s .co m driver.findElement(By.linkText("Credits")); } catch (NoSuchElementException nseex) { fail(); } driver.manage().deleteAllCookies(); }
From source file:OnlineShopTest.OnlineShopTest.java
/** * User Story 3 As a user, I already have an account And login successfully * So that I can check my profile Further to do some search, add products to * my cart, and further place order./*from w w w. j a v a 2s . c o m*/ * * @author Gery_xun * */ // Scenario 7: // Given that I am already logged in // When I try to click Purchase History // Since I never place any orders // Then it should show "No transactions for this month." @Test public void testHistory() { driver.get("http://store.demoqa.com/products-page/your-account/"); driver.findElement(By.id("log")).sendKeys("Xun" + Keys.RETURN); driver.findElement(By.id("pwd")).sendKeys("tZRO7dFmGE$t2rVR" + Keys.RETURN); driver.findElement(By.id("login")).click(); By topToolBar = By.id("wp-admin-bar-my-account"); waitUntil(d -> d.findElement(topToolBar).isDisplayed()); try { driver.findElement(By.linkText("Purchase History")).click(); WebElement result = driver.findElement(By.className("logdisplay")); assertTrue(result.getText().contains("No transactions for this month.")); } catch (NoSuchElementException nseex) { fail(); } driver.manage().deleteAllCookies(); }
From source file:OnlineShopTest.OnlineShopTest.java
@Test public void testSearch() { driver.get("http://store.demoqa.com/"); driver.findElement(By.className("search")).clear(); // driver.findElement(By.className("searchform")).clear(); driver.findElement(By.className("search")).sendKeys("iPhone" + Keys.RETURN); // driver.findElement(By.className("searchform")).click(); By title = By.className("prodtitle"); waitUntil(d -> d.findElement(title).isDisplayed()); // String title = driver.getTitle(); // assertTrue(title.contains("iPhone 5")); try {/*from w w w. j a va2s . c o m*/ driver.findElement(By.linkText("iPhone 5")); } catch (NoSuchElementException nseex) { fail(); } driver.manage().deleteAllCookies(); }
From source file:OnlineShopTest.OnlineShopTest.java
@Test public void testAdd() { driver.get("http://store.demoqa.com/products-page/your-account/"); driver.findElement(By.id("log")).sendKeys("Xun" + Keys.RETURN); driver.findElement(By.id("pwd")).sendKeys("tZRO7dFmGE$t2rVR" + Keys.RETURN); driver.findElement(By.id("login")).click(); By topToolBar = By.id("wp-admin-bar-my-account"); waitUntil(d -> d.findElement(topToolBar).isDisplayed()); driver.findElement(By.className("search")).clear(); // driver.findElement(By.className("searchform")).clear(); driver.findElement(By.className("search")).sendKeys("iPhone 5" + Keys.RETURN); // driver.findElement(By.className("searchform")).click(); By title = By.className("prodtitle"); waitUntil(d -> d.findElement(title).isDisplayed()); // String title = driver.getTitle(); // assertTrue(title.contains("iPhone 5")); try {/*from w ww . j a v a 2 s . com*/ List<WebElement> web = driver.findElements(By.tagName("input")); web.get(5).click(); WebElement result = driver.findElement(By.id("fancy_notification_content")); assertTrue(result.getText().contains("You just added \"iPhone 5\" to your cart")); } catch (NoSuchElementException nseex) { fail(); } driver.manage().deleteAllCookies(); }
From source file:org.alfresco.po.share.DashBoardPageTest.java
License:Open Source License
@Test(dependsOnMethods = "refreshPage", enabled = false, groups = "nonGrid") public void testKeysForHeaderBar() throws Exception { driver.navigate().refresh();//ww w.jav a 2 s . c o m dashBoard.inputFromKeyborad(Keys.TAB); dashBoard.inputFromKeyborad(Keys.ARROW_RIGHT); dashBoard.inputFromKeyborad(Keys.ARROW_RIGHT); dashBoard.inputFromKeyborad(Keys.RETURN); Assert.assertTrue(resolvePage(driver).render() instanceof SharedFilesPage); }
From source file:org.alfresco.po.share.search.FacetedSearchHeaderSearchForm.java
License:Open Source License
/** * Performs a search for the provided searchTerm. * * @param searchTerm the term upon which to search * @return the html page/* w ww. j a va 2 s .c om*/ */ public HtmlPage search(String searchTerm) { clearSearchTerm(); setSearchTerm(searchTerm); this.input.sendKeys(Keys.RETURN); return factoryPage.getPage(this.driver); }
From source file:org.alfresco.po.share.search.LiveSearchDropdownTest.java
License:Open Source License
/** * Checks that when pressing Enter in liveSearch with Search site scope, the scope in Search Results page is * set to current site/*from w ww . ja v a2s . c om*/ * */ @Test(priority = 15) public void testLiveSearchToFacetedInSiteScope() { docLib = siteActions.navigateToDocumentLibrary(driver, siteName).render(); SearchBox search = docLib.getSearch().render(); LiveSearchDropdown liveSearchResultPage = search.liveSearch(fileName).render(); liveSearchResultPage = liveSearchResultPage.selectScope(Scope.SITE).render(); String scopeSiteName = liveSearchResultPage.getScopeSiteName(); FacetedSearchPage facetedResultsPage = liveSearchResultPage.getSearch().search(fileName + Keys.RETURN) .render(); Assert.assertEquals(facetedResultsPage.getScopeMenu().getCurrentSelection(), scopeSiteName); // TODO: Check results are returned accordingly }
From source file:org.alfresco.po.share.search.LiveSearchDropdownTest.java
License:Open Source License
/** * Checks that when pressing Enter in liveSearch with Search Alfresco scope, the scope in Search Results page is * set to Repository/*from w ww .j a va2s . co m*/ * */ @Test(priority = 16) public void testLiveSearchToFacetedInRepositoryScope() { docLib = siteActions.navigateToDocumentLibrary(driver, siteName).render(); SearchBox search = docLib.getSearch().render(); LiveSearchDropdown liveSearchResultPage = search.liveSearch(fileName).render(); liveSearchResultPage.selectScope(Scope.REPO); FacetedSearchPage facetedResultsPage = liveSearchResultPage.getSearch().search(fileName + Keys.RETURN) .render(); Assert.assertEquals(facetedResultsPage.getScopeMenu().getCurrentSelection(), "Repository"); // TODO: Check results are returned accordingly }
From source file:org.apache.openmeetings.test.selenium.AbstractTestDefaults.java
License:Apache License
private void doInstallation() throws Exception { Thread.sleep(3000L);// w w w. j av a 2s . co m List<WebElement> buttons_next = SeleniumUtils.findElements(driver, "buttons:next", true); buttons_next.get(1).sendKeys(Keys.RETURN); Thread.sleep(1000L); SeleniumUtils.inputText(driver, "view:cfg.username", getUsername()); SeleniumUtils.inputText(driver, "view:cfg.password", getUserpass()); SeleniumUtils.inputText(driver, "view:cfg.email", getEmail()); SeleniumUtils.inputText(driver, "view:cfg.group", getGroupName()); buttons_next = SeleniumUtils.findElements(driver, "buttons:next", true); buttons_next.get(1).sendKeys(Keys.RETURN); Thread.sleep(1000L); buttons_next = SeleniumUtils.findElements(driver, "buttons:next", true); buttons_next.get(1).sendKeys(Keys.RETURN); Thread.sleep(1000L); buttons_next = SeleniumUtils.findElements(driver, "buttons:next", true); buttons_next.get(1).sendKeys(Keys.RETURN); Thread.sleep(1000L); buttons_next = SeleniumUtils.findElements(driver, "buttons:next", true); buttons_next.get(1).sendKeys(Keys.RETURN); Thread.sleep(2000L); List<WebElement> elements = SeleniumUtils.findElements(driver, "buttons:finish", true); elements.get(1).sendKeys(Keys.RETURN); long maxMilliSecondsWait = 120000; while (maxMilliSecondsWait > 0) { // check if installation is complete by searching for the link on // the success page WebElement enterApplicationLink = SeleniumUtils.findElement(driver, "//a[contains(@href,'install')]", false, true); if (enterApplicationLink == null) { System.out.println("Installation running - wait 3 more seconds and check again"); Thread.sleep(3000L); maxMilliSecondsWait -= 3000; } else { maxMilliSecondsWait = 0; enterApplicationLink.click(); return; } } throw new Exception("Timeout during installation"); }
From source file:org.apache.zeppelin.integration.ParagraphActionsIT.java
License:Apache License
@Test public void testNoteDynamicFormTextInput() throws Exception { try {/*from ww w . java 2s . c o m*/ createNewNote(); setTextOfParagraph(1, "%spark println(\"Hello \"+z.noteTextbox(\"name\", \"world\")) "); runParagraph(1); waitForParagraph(1, "FINISHED"); collector.checkThat("Output text is equal to value specified initially", driver.findElement( By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'text plainTextContent')]")) .getText(), CoreMatchers.equalTo("Hello world")); driver.findElement(By.xpath(getNoteFormsXPath() + "//input")).clear(); driver.findElement(By.xpath(getNoteFormsXPath() + "//input")).sendKeys("Zeppelin"); driver.findElement(By.xpath(getNoteFormsXPath() + "//input")).sendKeys(Keys.RETURN); collector.checkThat("After new data in text input form, output should not be changed", driver.findElement( By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'text plainTextContent')]")) .getText(), CoreMatchers.equalTo("Hello world")); runParagraph(1); waitForParagraph(1, "FINISHED"); collector.checkThat("Only after running the paragraph, we can see the newly updated output", driver.findElement( By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'text plainTextContent')]")) .getText(), CoreMatchers.equalTo("Hello Zeppelin")); setTextOfParagraph(2, "%spark println(\"Hello \"+z.noteTextbox(\"name\", \"world\")) "); runParagraph(2); waitForParagraph(2, "FINISHED"); collector.checkThat("Running the another paragraph with same form, we can see value from note form", driver.findElement( By.xpath(getParagraphXPath(2) + "//div[contains(@class, 'text plainTextContent')]")) .getText(), CoreMatchers.equalTo("Hello Zeppelin")); deleteTestNotebook(driver); } catch (Exception e) { handleException("Exception in ParagraphActionsIT while testNoteDynamicFormTextInput ", e); } }