@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 testIncorrectIncorrect() throws Exception { driver.get(baseUrl + "/"); driver.findElement(By.linkText("Log In")).click(); driver.findElement(By.id("navbar_username")).clear(); driver.findElement(By.id("navbar_username")).sendKeys("wrong"); driver.findElement(By.id("navbar_password")).clear(); driver.findElement(By.id("navbar_password")).sendKeys("wrong"); driver.findElement(By.cssSelector("input.button")).click(); assertEquals("Log In", driver.findElement(By.linkText("Log In")).getText()); driver.findElement(By.cssSelector("img[alt=\"Myth-Weavers\"]")).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"); } }
// *** Supression des risques de banques @Test public void testSSV8VALDEBTA997IntegrationTests() 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:0:sdksds")).click(); findElement(By.xpath("(//img[@alt='English'])[11]")).click(); findElement(By.linkText("Managing Risk")).click(); new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr"))) .selectByVisibleText("banque test 1"); Thread.sleep(1000); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); findElement(By.xpath("//td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr"))) .selectByVisibleText("banque test 2"); Thread.sleep(1000); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); findElement(By.xpath("//td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[2]/a")).click(); findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[2]/a")).click(); findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[2]/a")).click(); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr"))) .selectByVisibleText("banque test 3"); Thread.sleep(1000); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); findElement(By.xpath("//td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr"))) .selectByVisibleText("banque test 2"); Thread.sleep(1000); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); findElement(By.xpath("//td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click(); findElement(By.xpath("//td/div[3]/a")).click(); findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click(); findElement(By.xpath("(//img[@alt='English'])[2]")).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 testOtsi() throws Exception { driver.get(baseUrl + "/"); driver.findElement(By.linkText("Kandidaadid")).click(); // Warning: waitForTextPresent may require manual changes for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (driver .findElement(By.cssSelector("BODY")) .getText() .matches("^[\\s\\S]*Vana Kala[\\s\\S]*$")) break; } catch (Exception e) { } Thread.sleep(1000); } driver.findElement(By.id("nimi")).clear(); driver.findElement(By.id("nimi")).sendKeys("Magdalena"); try { assertEquals("Magdalena", driver.findElement(By.id("nimi")).getAttribute("value")); } catch (Error e) { verificationErrors.append(e.toString()); } driver.findElement(By.id("sButton")).click(); // Warning: waitForTextPresent may require manual changes for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (driver .findElement(By.cssSelector("BODY")) .getText() .matches("^[\\s\\S]*Magdalena Malejeva[\\s\\S]*$")) break; } catch (Exception e) { } Thread.sleep(1000); } // Warning: verifyTextNotPresent may require manual changes try { assertFalse( driver .findElement(By.cssSelector("BODY")) .getText() .matches("^[\\s\\S]*Vana Kala[\\s\\S]*$")); } catch (Error e) { verificationErrors.append(e.toString()); } }
@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 testWeather() throws Exception { driver.get(baseUrl + "/"); driver.findElement(By.linkText("Edmonton")).click(); for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (isElementPresent(By.id("cityjump"))) break; } catch (Exception e) { } Thread.sleep(1000); } // Warning: verifyTextPresent may require manual changes try { assertTrue( driver .findElement(By.cssSelector("BODY")) .getText() .matches("^[\\s\\S]*Current Conditions[\\s\\S]*$")); } catch (Error e) { verificationErrors.append(e.toString()); } // Warning: verifyTextPresent may require manual changes try { assertTrue( driver .findElement(By.cssSelector("BODY")) .getText() .matches("^[\\s\\S]*Forecast[\\s\\S]*$")); } catch (Error e) { verificationErrors.append(e.toString()); } // Warning: verifyTextPresent may require manual changes try { assertTrue( driver .findElement(By.cssSelector("BODY")) .getText() .matches("^[\\s\\S]*Edmonton City Centre Airport[\\s\\S]*$")); } catch (Error e) { verificationErrors.append(e.toString()); } }
@Test public void testContactAdd() throws Exception { driver.get(LoginHelper.baseUrl + "/Account/Login?ReturnUrl=%2f"); LoginHelper.login(driver); try { Thread.sleep(2000); } catch (InterruptedException x) { } driver.findElement(By.id("tileContactModule")).click(); driver.findElement(By.linkText("Добавить новый")).click(); driver.findElement(By.id("FirstName")).click(); driver.findElement(By.id("FirstName")).clear(); driver.findElement(By.id("FirstName")).sendKeys("AutoName"); driver.findElement(By.id("LastName")).click(); driver.findElement(By.id("LastName")).clear(); driver.findElement(By.id("LastName")).sendKeys("Auto2Name"); new Select(driver.findElement(By.id("SpecialityId"))).selectByVisibleText("Chirurg"); driver.findElement(By.id("bntSave")).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 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(); }
private void viewEditProfile() throws InterruptedException { driver.findElement(By.linkText("My Profile")).click(); driver.findElement(By.linkText("View Profile")).click(); // driver.findElement(By.id("photoBlockClose")).click(); driver.findElement(By.linkText("My Profile")).click(); driver.findElement(By.linkText("Edit my profile")).click(); new Select(driver.findElement(By.id("ethnicity"))).selectByVisibleText("Mixed Race"); new Select(driver.findElement(By.id("height"))).selectByVisibleText("4ft. 10in."); Thread.sleep(4000); driver.findElement(By.id("submit_basic_information")).click(); Thread.sleep(4000); driver.findElement(By.id("aboutMyself")).click(); driver.findElement(By.id("aboutMyself")).clear(); driver .findElement(By.id("aboutMyself")) .sendKeys("this is 5145502181, email [email protected], web: www.abc.com"); Thread.sleep(4000); driver.findElement(By.id("submit_about_myself")).click(); Thread.sleep(4000); driver.findElement(By.id("lookingFor")).click(); driver.findElement(By.id("lookingFor")).clear(); driver .findElement(By.id("lookingFor")) .sendKeys("my url is www.kala.com, 4389439088, email id is [email protected]"); Thread.sleep(4000); driver.findElement(By.id("submit_who_im_looking_for")).click(); Thread.sleep(4000); driver.findElement(By.linkText("My Profile")).click(); driver.findElement(By.linkText("View Profile")).click(); Thread.sleep(3000); verifyChanges(); }
// Test Case 8: Validating the view and edit profile - Changing fields in mini-profile to see the // changes displayed private void profileEditViewSetUp() throws InterruptedException { profilePage1(); String emailShuffled = shuffleEmail(email); driver.findElement(By.id("nickName")).click(); driver.findElement(By.id("nickName")).clear(); driver.findElement(By.id("nickName")).sendKeys("Neel"); new Select(driver.findElement(By.id("DOBMonth"))).selectByVisibleText("January"); driver.findElement(By.cssSelector("option[value=\"01\"]")).click(); new Select(driver.findElement(By.id("DOBDay"))).selectByVisibleText("04"); driver.findElement(By.cssSelector("#DOBDay > option[value=\"02\"]")).click(); new Select(driver.findElement(By.id("DOBYear"))).selectByVisibleText("1994"); driver.findElement(By.cssSelector("option[value=\"1994\"]")).click(); driver.findElement(By.id("email")).click(); driver.findElement(By.id("email")).clear(); driver.findElement(By.id("email")).sendKeys(emailShuffled + "@def.com"); driver.findElement(By.id("emailConfirmation")).click(); driver.findElement(By.id("emailConfirmation")).clear(); driver.findElement(By.id("emailConfirmation")).sendKeys(emailShuffled + "@def.com"); driver.findElement(By.id("password")).click(); driver.findElement(By.id("password")).clear(); driver.findElement(By.id("password")).sendKeys("target"); Thread.sleep(3000); driver.findElement(By.cssSelector("input.submitButton.green")).click(); driver.findElement(By.id("headline")).click(); driver.findElement(By.id("headline")).clear(); driver.findElement(By.id("headline")).sendKeys("I am fine!!!"); driver.findElement(By.id("country")).click(); new Select(driver.findElement(By.id("country"))).selectByVisibleText("Canada"); driver.findElement(By.cssSelector("option[value=\"39\"]")).click(); driver.findElement(By.id("postalCode")).click(); driver.findElement(By.id("postalCode")).clear(); driver.findElement(By.id("postalCode")).sendKeys("H3S1H4"); new Select(driver.findElement(By.id("education"))).selectByVisibleText("Graduate degree"); driver.findElement(By.cssSelector("#education > option[value=\"7\"]")).click(); new Select(driver.findElement(By.id("occupation"))).selectByVisibleText("Artist"); driver.findElement(By.cssSelector("#occupation > option[value=\"15\"]")).click(); new Select(driver.findElement(By.id("relationship"))).selectByVisibleText("Single"); driver.findElement(By.cssSelector("#relationship > option[value=\"3\"]")).click(); // driver.findElement(By.id("income")).click(); new Select(driver.findElement(By.id("income"))).selectByVisibleText("$25,000-$50,000"); driver.findElement(By.cssSelector("#income > option[value=\"4\"]")).click(); // driver.findElement(By.id("religion")).click(); new Select(driver.findElement(By.id("religion"))).selectByVisibleText("Other"); driver.findElement(By.cssSelector("#religion > option[value=\"3\"]")).click(); // driver.findElement(By.id("fbCloseButton")).click(); new Select(driver.findElement(By.id("height"))).selectByVisibleText("5ft. 6in."); driver.findElement(By.cssSelector("#height > option[value=\"166\"]")).click(); // driver.findElement(By.id("ethnicity")).click(); new Select(driver.findElement(By.id("ethnicity"))).selectByVisibleText("Asian"); driver.findElement(By.cssSelector("#ethnicity > option[value=\"5\"]")).click(); // driver.findElement(By.id("bodyType")).click(); new Select(driver.findElement(By.id("bodyType"))).selectByVisibleText("Average"); driver.findElement(By.cssSelector("#bodyType > option[value=\"5\"]")).click(); // driver.findElement(By.id("eyeColor")).click(); new Select(driver.findElement(By.id("eyeColor"))).selectByVisibleText("Black"); driver.findElement(By.cssSelector("#eyeColor > option[value=\"8\"]")).click(); // driver.findElement(By.id("hairColor")).click(); new Select(driver.findElement(By.id("hairColor"))).selectByVisibleText("Black"); driver.findElement(By.cssSelector("#hairColor > option[value=\"7\"]")).click(); // driver.findElement(By.id("smoking")).click(); new Select(driver.findElement(By.id("smoking"))).selectByVisibleText("Often"); driver.findElement(By.cssSelector("#smoking > option[value=\"5\"]")).click(); // driver.findElement(By.id("alcohol")).click(); new Select(driver.findElement(By.id("alcohol"))).selectByVisibleText("Occasionally"); driver.findElement(By.cssSelector("#alcohol > option[value=\"4\"]")).click(); driver.findElement(By.cssSelector("input.submitButton.green")).click(); Thread.sleep(3000); driver.findElement(By.linkText("I promise to upload a photo later")).click(); Thread.sleep(3000); driver.findElement(By.linkText("close")).click(); viewEditProfile(); }
@Test public void LFTMain() throws Exception { JavascriptExecutor js = (JavascriptExecutor) webDriver; selenium.open(baseUrl); selenium.type("id=id_username", sender); selenium.type("id=id_password", "123abc"); selenium.click("css=input[type=\"submit\"]"); selenium.waitForPageToLoad("2000"); System.out.println("First: The page title is " + selenium.getTitle()); // code to upload file driver.findElement(By.linkText("Compose")).click(); selenium.waitForPageToLoad("3000"); // Runtime.getRuntime().exec("C:\\Users\\Sneha\\Desktop\\IE.exe"); Runtime.getRuntime().exec("C:\\Users\\Sneha\\Desktop\\silver_autoit.exe"); Functions.MyWaitfunc(driver, "//*[@id='uploader_browse']"); WebElement ele = driver.findElement(By.xpath("//*[@id='uploader_browse']")); ele.click(); // ele.sendKeys("C:\\Users\\Sneha\\Desktop\\Lighthouse.jpg"); // send secure mail // driver.findElement(By.id("secure")).click(); driver.findElement(By.id("addrin")).sendKeys(recipient); driver.findElement(By.id("id_subject")).sendKeys(stringToTest_tc001); String torun = "document.getElementById('tinymce').innerHTML='Hi there!'"; driver.findElement(By.id("addrsubmit")).click(); /*selenium.waitForPageToLoad("3000"); Thread.sleep(100); js.executeScript(torun); System.out.println((String)js.executeScript("return document.title")); */ driver.switchTo().frame("id_body_ifr"); selenium.typeKeys("//body[@id='tinymce']", "Finally wohoooo!!"); driver.switchTo().defaultContent(); driver.findElement(By.id("submitter")).click(); /* code only if it is LFT String per_done="//html/body/div/div[2]/div[4]/form/fieldset/div[9]/div/div/div/div[2]/table[2]/tbody/tr/td[3]/span"; NoSuchElementException e1 = null; // code to wait for file to be uploaded for (int second = 0;; second++) { if (second >= 60) {fail("timeout");} try { if (driver.findElement(By.xpath(per_done)).getText().equalsIgnoreCase("548 KB")) break; } catch (Exception e) {} Thread.sleep(1000); } */ // mail body /* code to run if LFT //System.out.println((String)js. if((this.doesWebElementExist(driver,By.xpath(per_done))) && (driver.findElement(By.xpath(per_done)).getText().equalsIgnoreCase("548 KB"))) {//driver.findElement(By.id("submitter")).click(); } else throw e1; */ /* this section if confirm dialog pops up! this.MyWaitfunc("//html/body/div[4]/div[11]/div/button/span"); if(driver.findElement(By.xpath("//html/body/div[4]/div[11]/div/button/span")).isDisplayed()) driver.findElement(By.xpath("//html/body/div[4]/div[11]/div/button/span")).click(); else System.out.println("Confirm dialog not up yet!"); */ // to check if mail was sent successfully String success_str_xpath = "//html/body/div/div[2]/div[3]/ul/li"; Functions.MyWaitfunc(driver, success_str_xpath); if ((Functions.doesWebElementExist(driver, By.xpath(success_str_xpath))) && (driver .findElement(By.xpath(success_str_xpath)) .getText() .contains("Successfully sent the email"))) System.out.println("SUCCESS:Mail successfully sent !"); else { System.out.println("FAIL:Mail NOT SENT !"); System.out.println(driver.findElement(By.xpath(success_str_xpath)).getText()); Exception e1 = null; throw e1; } }