@Test public void testUntitled() throws Exception { driver.get(baseUrl + "en/login"); driver.findElement(By.id("signin_username")).clear(); driver.findElement(By.id("signin_username")).sendKeys("admin"); driver.findElement(By.id("signin_password")).clear(); driver.findElement(By.id("signin_password")).sendKeys("admin"); driver.findElement(By.cssSelector("button.button")).click(); driver.get(baseUrl + "/en/profile/edit"); driver.findElement(By.xpath("(//img[@alt='Leave this community'])[3]")).click(); assertTrue(closeAlertAndGetItsText().matches("^Are you sure[\\s\\S]$")); driver.findElement(By.xpath("(//img[@alt='Leave this community'])[2]")).click(); assertTrue(closeAlertAndGetItsText().matches("^Are you sure[\\s\\S]$")); driver.findElement(By.cssSelector("a[alt=\"Leave\"]")).click(); assertTrue(closeAlertAndGetItsText().matches("^Are you sure[\\s\\S]$")); driver.findElement(By.id("profile_community_comunity")).click(); new Select(driver.findElement(By.id("profile_community_community"))) .selectByVisibleText("My Sample Community #1"); driver.findElement(By.cssSelector("button")).click(); new Select(driver.findElement(By.id("profile_community_community"))) .selectByVisibleText("My Sample Community #2"); driver.findElement(By.cssSelector("button")).click(); new Select(driver.findElement(By.id("profile_community_community"))) .selectByVisibleText("CAPS"); driver.findElement(By.cssSelector("button")).click(); driver.findElement(By.cssSelector("button.button.submitButton")).click(); }
private void Location() throws IOException { // Click Location driver .findElement( By.xpath( "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Location\")]")) .click(); // Click West Checkbox // TODO Do not use number in Locator driver.findElement(By.xpath("//fieldset[6]/div/div[4]/div/div[3]/input")).click(); // Click South Checkbox // TODO Do not use number in Locator driver.findElement(By.xpath("//fieldset[6]/div/div[4]/div/div[6]/input")).click(); // Click Apply driver.findElement(By.id("edit-location-apply-filter")).click(); // Check Result Received or Not try { assertTrue( func.isTextPresent(driver.findElement(By.className("search-total-results")).getText())); } catch (Error e) { verificationErrors.append(e.toString()); } // Click All Selections driver.findElement(By.linkText("Clear All Selections")).click(); }
@Test public void testEditProfile() throws Exception { driver.get(baseUrl + "/"); driver.findElement(By.xpath("(//a[contains(text(),'log in')])[2]")).click(); driver.findElement(By.xpath("(//a[contains(text(),'log in')])[2]")).click(); driver.findElement(By.id("email")).click(); driver.findElement(By.id("email")).clear(); driver.findElement(By.id("email")).sendKeys("*****@*****.**"); driver.findElement(By.id("password")).clear(); driver.findElement(By.id("password")).sendKeys("Eliandtyler1"); driver.findElement(By.id("submit-button")).click(); driver.findElement(By.id("submit-button")).click(); driver.findElement(By.cssSelector("img.avatar-me.js-avatar-me")).click(); driver.findElement(By.cssSelector("img.avatar-me.js-avatar-me")).click(); driver.findElement(By.linkText("Edit Profile & Settings")).click(); driver.findElement(By.linkText("Edit Profile & Settings")).click(); // Warning: assertTextPresent may require manual changes assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$")); // Warning: assertTextPresent may require manual changes assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$")); // Warning: assertTextPresent may require manual changes assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$")); // Warning: assertTextPresent may require manual changes assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$")); // Warning: assertTextPresent may require manual changes assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$")); }
@Test public void testGotoFinalReview() throws Exception { // Goto Final Review page driver.findElement(By.xpath("//a[contains(text(), 'Final Review')]")).click(); try { assertEquals( "Final Review", driver.findElement(By.xpath("//*[@id='container']/h3")).getText()); } catch (Error e) { screenShots.takeScreenShot("gotoFinalReview"); verificationErrors.append(e.toString()); } Thread.sleep(300); // Find where the warning is displayed and scroll it into view, then screenshot it. // We look for 'Scholarship and Sponsorship' since the warning is in the 'Qualifications' area // and the scrolling is causing a heading right where we scroll to and covers it. WebElement elem = driver.findElement(By.xpath("//h4[contains(text(), 'Scholarship and Sponsorship')]")); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", elem); Thread.sleep(300); screenShots.takeScreenShot("FinalReviewWarnMsgNoQualifEntrd"); // Go back to application driver.findElement(By.cssSelector("#link_to_application > span")).click(); }
private void ActivitiesOfInterest() throws IOException { // Click Activities of Interest driver .findElement( By.xpath( "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Activities of Interest\")]")) .click(); // Click Student Newspaper Checkbox // TODO Do not use number in locator driver.findElement(By.xpath("//div[11]/input")).click(); // Click TV Station Checkbox // TODO Do not use number in locator driver.findElement(By.xpath("//div[13]/input")).click(); // Click Apply driver.findElement(By.id("edit-activities-interests-apply-filter")).click(); // Check Result Received or Not try { assertTrue( func.isTextPresent(driver.findElement(By.className("search-total-results")).getText())); } catch (Error e) { verificationErrors.append(e.toString()); } // Click All Selections driver.findElement(By.linkText("Clear All Selections")).click(); }
private void AreaOfStudy() throws IOException, InterruptedException { // Click Area of School driver .findElement( By.xpath( "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Area of Study\")]")) .click(); // Select One Area Study new Select(driver.findElement(By.id("edit-area-of-study-parent"))) .selectByVisibleText("Area, Ethnic, Cultural, and Gender Studies"); // Wait For Another Select List To Load Thread.sleep(5000); // Select Subareas of Study new Select(driver.findElement(By.xpath("//div[@id='child-area-of-study-wrapper']//select"))) .selectByVisibleText("Area, Ethnic, Cultural, and Gender Studies, Other"); // Click Apply driver.findElement(By.id("edit-area-of-study-apply-filter")).click(); // Check Result Received or Not try { assertTrue( func.isTextPresent(driver.findElement(By.className("search-total-results")).getText())); } catch (Error e) { verificationErrors.append(e.toString()); } // Click All Selections driver.findElement(By.linkText("Clear All Selections")).click(); }
@Test public void testMyFirstWebDriver() throws Exception { driver.get(baseUrl + "/HotelApp/"); driver.findElement(By.linkText("New User Register Here")).isDisplayed(); driver.findElement(By.xpath(".//*[@id='username']")).clear(); driver.findElement(By.xpath(".//*[@id='username']")).sendKeys(""); driver.findElement(By.id("password")).clear(); driver.findElement(By.id("password")).sendKeys(""); driver.findElement(By.id("login")).click(); // actualText = driver.findElement(By.id("username_span")).getText(); actualText = driver.findElement(By.cssSelector(".login_error")).getText(); assertEquals(expectedText, actualText); }
@Test public void testNotificacaoObito() throws Exception { driver.get(baseUrl + "/sincap/"); driver.findElement(By.id("username")).clear(); driver.findElement(By.id("username")).sendKeys("111.111.111-11"); driver.findElement(By.id("password")).clear(); driver.findElement(By.id("password")).sendKeys("abc123"); driver.findElement(By.id("botaoLogin")).click(); driver.findElement(By.xpath("//ul[@id='dashboard-menu']/li[2]/a/span")).click(); driver.findElement(By.id("obito-tipoObito")).click(); new Select(driver.findElement(By.id("obito-tipoObito"))).selectByVisibleText("PCR"); driver.findElement(By.cssSelector("option[value=\"PCR\"]")).click(); new Select(driver.findElement(By.id("obito-paciente-documentoSocial-tipoDocumentoComFoto"))) .selectByVisibleText("RG"); driver.findElement(By.id("obito-paciente-documentoSocial-documento")).clear(); driver.findElement(By.id("obito-paciente-documentoSocial-documento")).sendKeys("3546545333"); driver.findElement(By.id("obito-paciente-nome")).clear(); driver.findElement(By.id("obito-paciente-nome")).sendKeys("Notificacao de obito"); driver.findElement(By.id("obito-paciente-dataNascimento")).clear(); driver.findElement(By.id("obito-paciente-dataNascimento")).sendKeys("12/04/1985"); driver.findElement(By.id("obito-paciente-dataInternacao")).clear(); driver.findElement(By.id("obito-paciente-dataInternacao")).sendKeys("10/08/2015"); driver.findElement(By.cssSelector("span.checked")).click(); driver.findElement(By.id("obito-paciente-sexo:0")).click(); driver.findElement(By.id("obito-paciente-nomeMae")).clear(); driver.findElement(By.id("obito-paciente-nomeMae")).sendKeys("Mae do obito"); driver.findElement(By.id("obito-paciente-numeroSUS")).clear(); driver.findElement(By.id("obito-paciente-numeroSUS")).sendKeys("156234434345"); driver.findElement(By.id("obito-paciente-numeroProntuario")).clear(); driver.findElement(By.id("obito-paciente-numeroProntuario")).sendKeys("2564554643"); driver.findElement(By.id("descricaoComentario")).clear(); driver.findElement(By.id("descricaoComentario")).sendKeys("comentario 1"); driver.findElement(By.id("btn-next")).click(); driver.findElement(By.id("obito-dataObito")).clear(); driver.findElement(By.id("obito-dataObito")).sendKeys("13/08/2015"); driver.findElement(By.id("horarioObito")).clear(); driver.findElement(By.id("horarioObito")).sendKeys("10:21"); new Select(driver.findElement(By.id("obito-setor"))).selectByVisibleText("CIRURGIA GERAL"); new Select(driver.findElement(By.id("obito-corpoEncaminhamento"))).selectByVisibleText("IML"); driver.findElement(By.xpath("//div[@id='uniform-obito-aptoDoacao:0']/span")).click(); driver.findElement(By.id("obito-aptoDoacao:0")).click(); driver.findElement(By.id("obito-primeiraCausaMortis")).clear(); driver.findElement(By.id("obito-primeiraCausaMortis")).sendKeys("causa 1"); driver.findElement(By.id("obito-segundaCausaMortis")).clear(); driver.findElement(By.id("obito-segundaCausaMortis")).sendKeys("causa 2"); driver.findElement(By.id("obito-terceiraCausaMortis")).clear(); driver.findElement(By.id("obito-terceiraCausaMortis")).sendKeys("causa 3"); driver.findElement(By.id("obito-quartaCausaMortis")).clear(); driver.findElement(By.id("obito-quartaCausaMortis")).sendKeys("causa 4"); driver.findElement(By.xpath("(//button[@type='button'])[3]")).click(); }
@Test public void testAbcd() throws Exception { driver.get(baseUrl + "/"); driver.findElement(By.linkText("Sign In")).click(); driver.findElement(By.linkText("Sign In")).getText(); driver.findElement(By.xpath("//input[@name='loginName']")).clear(); driver.findElement(By.xpath("//input[@name='loginName']")).sendKeys("*****@*****.**"); driver.findElement(By.xpath("//input[@name='password']")).clear(); driver.findElement(By.xpath("//input[@name='password']")).sendKeys("demo123"); driver.findElement(By.xpath("//input[@type='image']")).click(); driver.findElement(By.linkText("Money")).click(); driver.findElement(By.linkText("Portfolio")).click(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); WebElement table = driver.findElement(By.id("table-holding-data")); if (table.isDisplayed()) { List<WebElement> rows = table.findElements(By.tagName("tr")); System.out.println("Row Count - " + rows.size()); Iterator<WebElement> i = rows.iterator(); System.out.println("Table has following content"); while (i.hasNext()) { WebElement row = i.next(); List<WebElement> columns = row.findElements(By.tagName("td")); Iterator<WebElement> j = columns.iterator(); while (j.hasNext()) { WebElement column = j.next(); System.out.print(column.getText()); System.out.print(" | "); } System.out.println("--------------------"); } System.out.println("Table content is printed"); } else { System.out.println("Table not found"); } }
private void SpecialNeeds() throws IOException { // Click Special Needs driver .findElement( By.xpath( "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Special Needs\")]")) .click(); // Select Special Needs Select SpecialNeeds = new Select(driver.findElement(By.id("edit-special-needs"))); // Select Learning Center SpecialNeeds.selectByVisibleText("Learning Center"); // Select Early Syllabus SpecialNeeds.selectByVisibleText("Early syllabus"); // Click Apply driver.findElement(By.id("edit-special-needs-apply-filter")).click(); // Check Result Received or Not try { assertTrue( func.isTextPresent(driver.findElement(By.className("search-total-results")).getText())); } catch (Error e) { verificationErrors.append(e.toString()); } // Click All Selections driver.findElement(By.linkText("Clear All Selections")).click(); }
@Test public void testClientOptions() throws Exception { driver.get(baseUrl + "/login"); driver.findElement(By.id("inputEmail")).clear(); driver.findElement(By.id("inputEmail")).sendKeys("*****@*****.**"); driver.findElement(By.id("inputPassword")).clear(); driver.findElement(By.id("inputPassword")).sendKeys("qwerty"); driver.findElement(By.xpath("//button")).click(); driver.findElement(By.id("blockButton")).click(); driver.findElement(By.xpath("//p[3]/button")).click(); driver.findElement(By.xpath("//button[3]")).click(); driver.findElement(By.id("blockButton")).click(); driver.findElement(By.xpath("//p[3]/button")).click(); driver.findElement(By.id("discard")).click(); }
// Delete CSR @Test public void Test5() throws Exception { driver.get(baseUrl + "/#/host/magehostmanager.magemojo.com/configuration/ssl"); driver.findElement(By.xpath("//a[contains(text(),'www.Testing5.com')]")).click(); assertEquals( "Download CSR www.Testing5.com", driver.findElement(By.xpath("//legend[4]")).getText()); driver.findElement(By.xpath("(//button[@type='button'])[8]")).click(); assertEquals( "Confirmation Window", driver.findElement(By.cssSelector("h3.modal-title.ng-binding")).getText()); assertTrue(isElementPresent(By.xpath("//div[3]/button[2]"))); driver.findElement(By.xpath("//div[3]/button")).click(); for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if ("Successfully deleted the CSR." .equals(driver.findElement(By.xpath("//div[@id='toast-container']/div")).getText())) break; } catch (Exception e) { } Thread.sleep(1000); } for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (!isElementPresent(By.xpath("//a[contains(text(),'www.Testing5.com')]"))) break; } catch (Exception e) { } Thread.sleep(1000); } }
@Test public void testAddCampaign() throws Exception { driver.get(baseUrl + "/"); driver.findElement(By.id("username")).clear(); driver.findElement(By.id("username")).sendKeys("test"); driver.findElement(By.id("password")).clear(); driver.findElement(By.id("password")).sendKeys("test"); driver.findElement(By.cssSelector("button.btn.btn-default")).click(); driver.findElement(By.linkText("Campaigns")).click(); driver.findElement(By.cssSelector("button.btn.btn-default")).click(); driver.findElement(By.xpath("(//button[@type='button'])[2]")).click(); driver.findElement(By.cssSelector("div.input-group > input.form-control")).clear(); driver.findElement(By.cssSelector("div.input-group > input.form-control")).sendKeys("test2"); driver.findElement(By.cssSelector("span.input-group-btn > button.btn.btn-default")).click(); new Select(driver.findElement(By.cssSelector("select.form-control"))) .selectByVisibleText("test2"); driver.findElement(By.xpath("//button[@type='button']")).click(); }
@Test public void testCadastroCaptador() throws Exception { driver.get(baseUrl + "/sincap/"); driver.findElement(By.id("username")).clear(); driver.findElement(By.id("username")).sendKeys("555.555.555-55"); driver.findElement(By.id("password")).clear(); driver.findElement(By.id("password")).sendKeys("abc123"); driver.findElement(By.id("botaoLogin")).click(); driver.findElement(By.cssSelector("li.settings.hidden-phone > a")).click(); driver.findElement(By.xpath("//ul[@id='dashboard-menu']/li[2]/a/span")).click(); driver.findElement(By.xpath("//ul[@id='dashboard-menu']/li[2]/a/span")).click(); driver.findElement(By.xpath("//ul[@id='tabs']/li[3]/a/h4")).click(); driver.findElement(By.xpath("//div[@id='captador-table_wrapper']/div/div/div[3]/a/i")).click(); driver.findElement(By.id("nome")).clear(); driver.findElement(By.id("nome")).sendKeys("cadastro captador4"); driver.findElement(By.id("senha")).clear(); driver.findElement(By.id("senha")).sendKeys("abc123"); driver.findElement(By.id("confirmar-senha")).clear(); driver.findElement(By.id("confirmar-senha")).sendKeys("abc123"); driver.findElement(By.id("cpf")).clear(); driver.findElement(By.id("cpf")).sendKeys("182.180.980-12"); driver.findElement(By.id("documentoSocial-documento")).clear(); driver.findElement(By.id("documentoSocial-documento")).sendKeys("3248728342039"); new Select(driver.findElement(By.id("documentoSocial-tipoDocumentoComFoto"))) .selectByVisibleText("RG"); driver.findElement(By.id("email")).clear(); driver.findElement(By.id("email")).sendKeys("*****@*****.**"); new Select(driver.findElement(By.id("endereco-estado-id"))) .selectByVisibleText("Espírito Santo"); new Select(driver.findElement(By.id("endereco-cidade-id"))).selectByVisibleText("Serra"); new Select(driver.findElement(By.id("endereco-bairro-id"))) .selectByVisibleText("Chácara Parreiral"); driver.findElement(By.id("endereco-logradouro")).clear(); driver.findElement(By.id("endereco-logradouro")).sendKeys("rua"); driver.findElement(By.id("endereco-numero")).clear(); driver.findElement(By.id("endereco-numero")).sendKeys("84"); driver.findElement(By.id("endereco-complemento")).clear(); driver.findElement(By.id("endereco-complemento")).sendKeys("casa"); driver.findElement(By.id("endereco-cep")).clear(); driver.findElement(By.id("endereco-cep")).sendKeys("32498-20"); driver.findElement(By.id("telefone-numero")).sendKeys("(27)2717-8186"); new Select(driver.findElement(By.id("bancoOlhos-id"))).selectByVisibleText("BANCO DE OLHOS 1"); driver.findElement(By.xpath("//button[@type='submit']")).click(); }
@Test public void testLoginMaster2() throws Exception { driver.get(baseUrl + "/login.html"); driver.findElement(By.name("j_username")).clear(); driver.findElement(By.name("j_username")).sendKeys("*****@*****.**"); driver.findElement(By.name("j_password")).clear(); driver.findElement(By.name("j_password")).sendKeys("master"); driver.findElement(By.xpath("//input[@value='Login']")).click(); driver.findElement(By.linkText("Sign out")).click(); }
@Test public void testBookSearch5() throws Exception { driver.get(baseUrl + "/proyectoBiblioteca/"); new Select(driver.findElement(By.name("type"))).selectByVisibleText("Editorial"); driver.findElement(By.name("search")).clear(); driver.findElement(By.name("search")).sendKeys("De Bolsillo"); driver.findElement(By.xpath("//button[@type='submit']")).click(); assertEquals( "Libros Encontrados", driver.findElement(By.cssSelector("div.panel-heading")).getText()); }
@Test public void test35() throws Exception { driver.get(baseUrl + "/accountType/list"); driver.findElement(By.xpath("//strong[text()='Direct Customer']")).click(); driver.findElement(By.cssSelector("a.submit.edit > span")).click(); driver.findElement(By.id("creditLimitAsDecimal")).clear(); driver.findElement(By.id("creditLimitAsDecimal")).sendKeys("300.00"); driver.findElement(By.cssSelector("a.submit.save > span")).click(); driver.findElement(By.xpath("//strong[text()='Direct Customer']")).click(); driver.findElement(By.cssSelector("a.submit.edit > span")).click(); driver.findElement(By.id("creditLimitAsDecimal")).clear(); driver.findElement(By.id("creditLimitAsDecimal")).sendKeys("200.00"); driver.findElement(By.cssSelector("a.submit.save > span")).click(); driver.findElement(By.xpath("//strong[text()='Direct Customer']")).click(); Assert.assertEquals(driver.getPageSource().contains("US$200.00"), true); }
// *** l'utilisation des données "......" // ** et des données de longeurs de "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn" // pour le champ nom // * l'impossibilité de modifier l'id d'un motif de remplacemnt une fois enregistré @Test public void testSSV8VALDEBTA008cIntegrationTests() throws Exception { driver.get(baseUrl + "/selectsystem-view-tomcat-oracle/login.xhtml"); Thread.sleep(1000); findElement(By.id("j_username")).clear(); findElement(By.id("j_username")).sendKeys("usercenter"); Thread.sleep(1000); findElement(By.id("j_password")).clear(); findElement(By.id("j_password")).sendKeys("pwd8888"); findElement(By.cssSelector("#login > img[alt=\"Frensh\"]")).click(); optionalClick(By.xpath("//span/a")); findElement(By.id("form:table:1:sdksds")).click(); findElement(By.xpath("(//img[@alt='English'])[4]")).click(); findElement(By.xpath("(//a[contains(text(),'Card Replacement Motif')])[2]")).click(); new Select(findElement(By.id("globalCardReplacementMotifForm:bank"))) .selectByVisibleText("banque test 3"); Thread.sleep(1000); findElement(By.xpath("//table[@id='globalCardReplacementMotifForm:AZ']/tbody/tr/td/a[3]/img")) .click(); Thread.sleep(1000); findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear(); findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys(".........."); Thread.sleep(1000); findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear(); findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).sendKeys("ReasRp_031"); findElement(By.cssSelector("img[alt=\"save2\"]")).click(); findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click(); findElement(By.xpath("//table[@id='globalCardReplacementMotifForm:AZ']/tbody/tr/td/a[3]/img")) .click(); Thread.sleep(1000); findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear(); findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys("ReasRp_031"); Thread.sleep(1000); findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear(); findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")) .sendKeys("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"); findElement(By.cssSelector("img[alt=\"save2\"]")).click(); findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click(); findElement(By.xpath("//table[@id='globalCardReplacementMotifForm:AZ']/tbody/tr/td/a[3]/img")) .click(); Thread.sleep(1000); findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear(); findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys("ReasRp_033"); Thread.sleep(1000); findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear(); findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).sendKeys("ReasRp_033"); findElement(By.cssSelector("img[alt=\"save2\"]")).click(); findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click(); findElement( By.id( "globalCardReplacementMotifForm:searchCardDesignFeesResultsId:0:scxqsjhvcqjshcvhqsceee")) .click(); findElement(By.cssSelector("img[alt=\"save2\"]")).click(); findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click(); findElement(By.xpath("(//img[@alt='English'])[2]")).click(); }
@Test public void testGoal() throws Exception { driver.get(baseUrl + "/ubercoaching/logout"); driver.findElement(By.linkText("Login")).click(); driver.findElement(By.name("username")).clear(); driver.findElement(By.name("username")).sendKeys("test"); driver.findElement(By.name("password")).clear(); driver.findElement(By.name("password")).sendKeys("test"); driver.findElement(By.name("commit")).click(); driver.findElement(By.xpath("(//a[contains(text(),'PROCEED »')])[4]")).click(); driver.findElement(By.name("weight")).clear(); driver.findElement(By.name("weight")).sendKeys("75"); driver.findElement(By.name("width")).clear(); driver.findElement(By.name("width")).sendKeys("60"); driver.findElement(By.cssSelector("input[type=\"submit\"]")).click(); driver.findElement(By.name("goalWeight")).clear(); driver.findElement(By.name("goalWeight")).sendKeys("70"); driver.findElement(By.name("goalDate")).clear(); driver.findElement(By.name("goalDate")).sendKeys("20/05/2016"); driver.findElement(By.xpath("//input[@value='Set Goal']")).click(); }
@Test public void testHasContact() { // Check if webpage has "contact us" // these is not found, fail the test try { driver.findElement(By.xpath("//*[@id='nodesinblock-21']/article/section/p[1]/a")); } catch (NoSuchElementException nseex) { fail(); } }
@Test public void testRegistreerimine() throws Exception { driver.get(baseUrl + "/login"); driver.findElement(By.xpath("//button[5]")).click(); driver.findElement(By.id("kasutajanimi")).clear(); driver.findElement(By.id("kasutajanimi")).sendKeys("Testkasutaja"); driver.findElement(By.id("eesnimi")).clear(); driver.findElement(By.id("eesnimi")).sendKeys("Test"); driver.findElement(By.id("perenimi")).clear(); driver.findElement(By.id("perenimi")).sendKeys("Kasutaja"); driver.findElement(By.id("parool")).clear(); driver.findElement(By.id("parool")).sendKeys("testkasutaja"); driver.findElement(By.id("email")).clear(); driver.findElement(By.id("email")).sendKeys("*****@*****.**"); driver.findElement(By.id("telnr")).clear(); driver.findElement(By.id("telnr")).sendKeys("55123123"); driver.findElement(By.id("regamisnupp")).click(); try { assertEquals( "Registreerimine õnnestus!", driver.findElement(By.xpath("//div/div/div/div")).getText()); } catch (Error e) { verificationErrors.append(e.toString()); } }
@Test public void testLogin() throws Exception { // Create the file name and hope it's the same as created in Register Account // DateFormat dateFormat = new SimpleDateFormat("YYYYMMDDhh"); // Date date = new Date(); // String date1 = dateFormat.format(date); // File OutputFile = new File("C:\\Temp\\" + date1 + "-outputdata.txt"); File OutputFile = new File("C:\\Users\\uqmpette\\Documents\\MatsTest-outputdata.txt"); String loginUsername = null, loginPwd = ""; if (OutputFile.exists()) { // File already exists, great, it should contain loginEmail // Create Object of java FileReader and BufferedReader class. FileReader FR = new FileReader(OutputFile); BufferedReader BR = new BufferedReader(FR); Number Row = 1; String Content = ""; try { // Loop to read all lines one by one from file and print It. while ((Content = BR.readLine()) != null) { if (Row.equals(1)) { loginUsername = Content; } if (Row.equals(2)) { loginPwd = Content; } Row = 2; } } catch (FileNotFoundException e) { // Display error message if File was not found System.err.println("Unable to find the file"); } catch (IOException e) { // Display error message if an exception is encountered while reading the file System.err.println("Unable to read the file"); } BR.close(); } // Applicant login (SSO) driver.findElement(By.id("userid1")).clear(); driver.findElement(By.id("userid1")).sendKeys(loginUsername); driver.findElement(By.id("pwd")).clear(); driver.findElement(By.id("pwd")).sendKeys(loginPwd); driver.findElement(By.xpath("//*[@id='login']/table/tbody/tr[6]/td[2]/input")).click(); // Thread.sleep(2000); fluentWaitSI.fluentWait(By.id("fldra_HCAD_STUDENT_ADMISSIONS")); }
@Test( dataProvider = "addNewAgentApplicant", dataProviderClass = applicantDataInternationalNewApplicant.class) public void testEnterDataAddNewApplicant( String loginEmail, String loginPassword, String firstName, String lastName, String birthDay, String birthMonth, String birthYear) throws Exception { // Add new applicant to Agent Thread.sleep(300); // Test case from HERE to CITIZENSHIP will fail if the applicant already exists. driver.findElement(By.id("field-email")).clear(); driver.findElement(By.id("field-email")).sendKeys(loginEmail); Thread.sleep(150); driver.findElement(By.id("field-confirmEmail")).clear(); driver.findElement(By.id("field-confirmEmail")).sendKeys(loginEmail); Thread.sleep(100); driver.findElement(By.id("field-firstName")).clear(); driver.findElement(By.id("field-firstName")).sendKeys(firstName); driver.findElement(By.id("field-lastName")).clear(); driver.findElement(By.id("field-lastName")).sendKeys(lastName); new Select(driver.findElement(By.name("dayOfBirth"))).selectByVisibleText(birthDay); new Select(driver.findElement(By.name("monthOfBirth"))).selectByVisibleText(birthMonth); new Select(driver.findElement(By.name("yearOfBirth"))).selectByVisibleText(birthYear); driver.findElement(By.xpath("//button[@type='submit']")).click(); System.out.println("Applicant = " + loginEmail); Thread.sleep(500); try { assertEquals( "Profile Information", driver.findElement(By.cssSelector("h3.col-xs-12")).getText()); } catch (Error e) { screenShots.takeScreenShot("enterDataAddNewAppl"); verificationErrors.append(e.toString()); } }
@Test( dataProvider = "addCitizenshipInfo", dataProviderClass = applicantDataDomesticNewApplicant.class) public void testEnterDataCitizenshipResidencyDomestic( String citizenshipType, String domesticType, String fieldCitizenshipCountryId, String fieldBirthCountryId, String fieldResidenceCountryId, String ATSI) throws Exception { // Enter Citizenship driver.findElement(By.id(citizenshipType)).click(); driver.findElement(By.id(domesticType)).click(); Thread.sleep(300); selectFromSelect2.SelectDropDownOption("field-birthCountryId", fieldBirthCountryId); Thread.sleep(300); selectFromSelect2.SelectDropDownOption("field-residenceCountryId", fieldResidenceCountryId); driver.findElement(By.id("field-" + ATSI)).click(); driver.findElement(By.xpath("//input[@value='Save']")).click(); for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if ("Saved".equals(driver.findElement(By.cssSelector("div.toast-message")).getText())) break; } catch (Exception e) { screenShots.takeScreenShot("enterDataCitResDom1"); } Thread.sleep(1000); } // Goto Home or Dashboard driver.findElement(By.cssSelector("span.link-to-dashboard.dashboard-text")).click(); try { assertEquals( "Profile Information", driver.findElement(By.cssSelector("h3.col-xs-12")).getText()); } catch (Error e) { screenShots.takeScreenShot("enterDataCitResDom2"); verificationErrors.append(e.toString()); } }
@Test public void testFindKioskFlow() throws Exception { driver.findElement(By.xpath("//a[contains(@href, '/fluffbox-rwx/kiosk/find')]")).click(); driver.findElement(By.id("searchCriteria")).sendKeys("Ft. Lauderdale"); driver.findElement(By.id("searchButton")).click(); WebElement walgreensInsideLink = waitForDynamicElement(By.linkText("Walgreens (Inside)")); walgreensInsideLink.click(); WebElement gMapInfoWindow = waitForDynamicElement(By.cssSelector("div.gmnoprint > div.gmnoprint > div > div")); assertThat(gMapInfoWindow.getText(), containsString("3895 W Broward Blvd")); WebElement winnDixieOutsideLink = waitForDynamicElement(By.linkText("Winn Dixie (Outside)")); winnDixieOutsideLink.click(); gMapInfoWindow = waitForDynamicElement(By.cssSelector("div.gmnoprint > div.gmnoprint > div > div")); assertThat(gMapInfoWindow.getText(), containsString("1531 N State Road 7")); }
@Test public void testAssigneUsScrumMaster2() throws Exception { driver.get(baseUrl + "/login.html"); driver.findElement(By.name("j_username")).clear(); driver.findElement(By.name("j_username")).sendKeys("*****@*****.**"); driver.findElement(By.name("j_password")).clear(); driver.findElement(By.name("j_password")).sendKeys("product"); driver.findElement(By.xpath("//input[@value='Login']")).click(); driver.findElement(By.cssSelector("input.btn.btn-success")).click(); driver.findElement(By.id("tag_input")).clear(); driver.findElement(By.id("tag_input")).sendKeys("Crea Git"); driver.findElement(By.id("description_input")).clear(); driver.findElement(By.id("description_input")).sendKeys("Creation Depot git"); driver.findElement(By.id("priority_input")).clear(); driver.findElement(By.id("priority_input")).sendKeys("1"); driver.findElement(By.id("difficulty_input")).clear(); driver.findElement(By.id("difficulty_input")).sendKeys("5"); new Select(driver.findElement(By.id("master_input"))).selectByVisibleText("Scrum1 Master1"); driver.findElement(By.cssSelector("button.btn.btn-success")).click(); driver.findElement(By.linkText("Sign out")).click(); }
@Test public void testScenario4() throws Exception { driver.get(baseUrl + "/recipe/index.php"); driver.findElement(By.xpath("//div[@id='nav']/table/tbody/tr[7]/td/a/strong")).click(); driver.findElement(By.name("title")).clear(); driver.findElement(By.name("title")).sendKeys("Chicken Ramen"); driver.findElement(By.name("shortdesc")).clear(); driver.findElement(By.name("shortdesc")).sendKeys("Classic Ramen noodles"); driver.findElement(By.name("ingredients")).clear(); driver.findElement(By.name("ingredients")).sendKeys("Ramen package, 2 cups water"); driver.findElement(By.name("directions")).clear(); driver .findElement(By.name("directions")) .sendKeys( "Bring water to boil. Add noodles from package. Boil 7 minutes. Add flavor package."); driver.findElement(By.cssSelector("#main > form > input[type=\"submit\"]")).click(); // Warning: assertTextPresent may require manual changes assertTrue( driver .findElement(By.cssSelector("BODY")) .getText() .matches("^[\\s\\S]*Recipe posted[\\s\\S]*$")); }
private void Sports() throws IOException { // Click Sports driver .findElement( By.xpath("//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Sports\")]")) .click(); // Select Sports Select Sports = new Select(driver.findElement(By.id("edit-varsity-sports"))); // Select Baseball Sports.selectByVisibleText("baseball"); // Select Basketball Sports.selectByVisibleText("basketball"); // Click Apply driver.findElement(By.id("edit-varsity-sports-apply-filter")).click(); // Check Result Received or Not try { assertTrue( func.isTextPresent(driver.findElement(By.className("search-total-results")).getText())); } catch (Error e) { verificationErrors.append(e.toString()); } // Click All Selections driver.findElement(By.linkText("Clear All Selections")).click(); }
@Test( dataProvider = "addNewApplicant", dataProviderClass = applicantDataDomesticNewApplicant.class) public void testRegisterAccount( String loginEmail, String loginPassword, String firstName, String lastName, String birthDay, String birthMonth, String birthYear) throws Exception { // Register New Account driver.findElement(By.id("field-firstName")).clear(); driver.findElement(By.id("field-firstName")).sendKeys(firstName); driver.findElement(By.id("field-lastName")).clear(); driver.findElement(By.id("field-lastName")).sendKeys(lastName); new Select(driver.findElement(By.name("day"))).selectByVisibleText(birthDay); new Select(driver.findElement(By.name("month"))).selectByVisibleText(birthMonth); new Select(driver.findElement(By.name("year"))).selectByVisibleText(birthYear); driver.findElement(By.id("field-email")).clear(); driver.findElement(By.id("field-email")).sendKeys(loginEmail); driver.findElement(By.id("field-confirmEmail")).clear(); driver.findElement(By.id("field-confirmEmail")).sendKeys(loginEmail); driver.findElement(By.id("field-password")).clear(); driver.findElement(By.id("field-password")).sendKeys(loginPassword); driver.findElement(By.id("field-confirmPassword")).clear(); driver.findElement(By.id("field-confirmPassword")).sendKeys(loginPassword); driver.findElement(By.id("field-terms")).click(); driver.findElement(By.xpath("(//button[@type='submit'])[2]")).click(); try { assertEquals( "Successfully registered.", driver.findElement(By.cssSelector("div.alert.alert-success")).getText()); } catch (Error e) { screenShots.takeScreenShot("registerAcct_outp"); verificationErrors.append(e.toString()); } System.out.println("Applicant = " + loginEmail + " Password = " + loginPassword); // Write out the Applicants email address to the output file created in gotoSite.java // First create object of java FileWriter and BufferedWriter class. String WriteFile = generateFileName(); FileWriter FW = new FileWriter(WriteFile); BufferedWriter BW = new BufferedWriter(FW); BW.write(loginEmail); // Writing applicants login to File. BW.newLine(); // To write next string on new line. BW.write(lastName); // Writing applicants lastname to File. BW.newLine(); // To write next string on new line. BW.write(firstName); // Writing applicants first name to File. BW.newLine(); // To write next string on new line. BW.close(); }
@Test public void testCreateFolderAndFiles() throws Exception { // Click Docushare driver.findElement(By.linkText("DOCUSHARE")).click(); // Click Upload Document driver.findElement(By.cssSelector("span.show-file-add-form")).click(); // Add To Document Locker // Enter Document Name driver .findElement( By.xpath("//form[@id='content-type-doc-loc-files-node-form']//input[@name='title']")) .clear(); Tracking = func.RandomWords(3); driver .findElement( By.xpath("//form[@id='content-type-doc-loc-files-node-form']//input[@name='title']")) .sendKeys(Tracking[0] + " " + Tracking[1] + " " + Tracking[2]); // Upload File driver .findElement( By.xpath( "//div[contains(@class, 'field-name-field-doc-loc-uploaded-file-form')]//input")) .sendKeys("C:\\Users\\om\\Downloads\\abc.txt"); // Click Save driver .findElement( By.xpath( "//form[@id='content-type-doc-loc-files-node-form']//input[@class='form-submit']")) .click(); wait.until( ExpectedConditions.invisibilityOfElementLocated( By.xpath( "//form[@id='content-type-doc-loc-files-node-form']//input[@class='form-submit']"))); // Click Hidden Checkbox using Actions Class WebElement Element = driver.findElement( By.xpath( "//form[@id='views-form-views-document-locker-files-block']//div[contains(@class, 'views-row-first')]")); WebElement HiddenElement = driver.findElement( By.xpath( "//form[@id='views-form-views-document-locker-files-block']//div[contains(@class, 'views-row-first')]//input[@type='checkbox']")); Actions action = new Actions(driver); // Move To Element action.moveToElement(Element).perform(); // Wait For Checkbox To Be Shown Thread.sleep(200); // Click Checkbox action.click(HiddenElement).perform(); // Click download button driver .findElement(By.xpath("//form[@id='download-files-form']//input[@class='form-submit']")) .click(); // See Document in Different Form driver.findElement(By.cssSelector("span.show-file-list-form.file-showing-form")).click(); driver.findElement(By.cssSelector("span.show-file-grid-form.file-showing-form")).click(); // Click New Folder driver.findElement(By.cssSelector("span.show-folder-add-form")).click(); // Create Folder // Enter Folder Name driver .findElement( By.xpath("//form[@id='content-type-doc-loc-folder-node-form']//input[@name='title']")) .clear(); Tracking = func.RandomWords(2); driver .findElement( By.xpath("//form[@id='content-type-doc-loc-folder-node-form']//input[@name='title']")) .sendKeys(Tracking[0] + " " + Tracking[1]); // Select Parent func.SelectRandomSelectListOption( "//div[contains(@class, 'field-name-field-doc-loc-parent-folder-form')]//select"); // Click Save driver .findElement( By.xpath("//form[@id='content-type-doc-loc-folder-node-form']//input[@type='submit']")) .click(); wait.until( ExpectedConditions.invisibilityOfElementLocated( By.xpath( "//form[@id='content-type-doc-loc-folder-node-form']//input[@type='submit']"))); }