@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(); }
@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 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"); } }
@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 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 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 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 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 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]*$")); }
@Test public void testMap2() throws Exception { driver.get(baseUrl + "/ModSolarPlatform/login.jsp;jsessionid=F33B6C551CBA0A359E87354993539EFA"); driver.findElement(By.id("username")).clear(); driver.findElement(By.id("username")).sendKeys("christianqa"); driver.findElement(By.id("password")).clear(); driver.findElement(By.id("password")).sendKeys("qa"); driver.findElement(By.name("submit")).click(); driver.findElement(By.cssSelector("div.newLeadList")).click(); driver.findElement(By.id("tabResidential")).click(); driver.findElement(By.id("firstNameResidential")).clear(); driver.findElement(By.id("firstNameResidential")).sendKeys("christian"); driver.findElement(By.id("lastNameResidential")).clear(); driver.findElement(By.id("lastNameResidential")).sendKeys("Mabila"); driver.findElement(By.id("addressResidential")).clear(); driver.findElement(By.id("addressResidential")).sendKeys("600 Clipper rd"); driver.findElement(By.id("cityResidential")).clear(); driver.findElement(By.id("cityResidential")).sendKeys("Belmont"); new Select(driver.findElement(By.id("stateResidential"))).selectByVisibleText("California"); // driver.findElement(By.id("zipCodeResidential")).clear(); // driver.findElement(By.id("zipCodeResidential")).sendKeys("90042"); driver.findElement(By.cssSelector("#zipCodeResidential")).clear(); driver.findElement(By.cssSelector("#zipCodeResidential")).sendKeys("90042"); Thread.sleep(1500); driver.findElement(By.id("emailResidential")).clear(); driver.findElement(By.id("emailResidential")).sendKeys("*****@*****.**"); driver.findElement(By.id("utilityTaxRateInputAddressResidential")).clear(); driver.findElement(By.id("utilityTaxRateInputAddressResidential")).sendKeys("1.2"); driver.findElement(By.id("averageMonthlyBillResidential")).clear(); driver.findElement(By.id("averageMonthlyBillResidential")).sendKeys("225"); driver.findElement(By.id("nextBtn")).click(); Thread.sleep(1000); WebElement mainCanvas = driver.findElement(By.xpath(".//*[@id='mapCanvas']/div/div[1]/div[2]")); Actions mouseAction = new Actions(driver); mouseAction.moveToElement(mainCanvas); mouseAction.contextClick(mainCanvas); mouseAction.moveByOffset(5, 25); mouseAction.sendKeys(Keys.ARROW_DOWN); mouseAction.sendKeys(Keys.RETURN); // mouseAction.keyDown(Keys.ARROW_DOWN); // mouseAction.moveToElement(subMenu); mouseAction.click(); mouseAction.perform(); WebElement mainCanvas2 = driver.findElement( By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]")); Actions mouseAction2 = new Actions(driver); mouseAction2.moveToElement(mainCanvas2); mouseAction2.contextClick(mainCanvas2); mouseAction2.moveByOffset(70, 50); mouseAction2.sendKeys(Keys.ARROW_DOWN); mouseAction2.sendKeys(Keys.RETURN); // mouseAction.keyDown(Keys.ARROW_DOWN); // mouseAction.moveToElement(subMenu); mouseAction2.click(); mouseAction2.perform(); WebElement mainCanvas3 = driver.findElement( By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]")); Actions mouseAction3 = new Actions(driver); mouseAction3.moveToElement(mainCanvas3); mouseAction3.contextClick(mainCanvas3); mouseAction3.moveToElement(mainCanvas2, 500, 220); mouseAction3.sendKeys(Keys.ARROW_DOWN); mouseAction3.sendKeys(Keys.RETURN); // mouseAction.keyDown(Keys.ARROW_DOWN); // mouseAction.moveToElement(subMenu); mouseAction3.click(); mouseAction3.perform(); // Clicking inside the Triangle WebElement e = driver.findElement( By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]")); new Actions(driver).moveToElement(e, 0, 0).moveByOffset(520, 255).click().build().perform(); driver.findElement(By.cssSelector("div.pgNext.right > input.btn")).click(); driver.findElement(By.xpath("//div[@id='accordion']")).click(); driver.findElement(By.id("regionsPaneTitle")).click(); // Clicking inside the Triangle 1 WebElement eI = driver.findElement( By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]")); new Actions(driver).moveToElement(eI, 0, 0).moveByOffset(520, 255).click().build().perform(); Thread.sleep(1000); // Clicking inside the Triangle 1 WebElement eS = driver.findElement( By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]")); new Actions(driver).moveToElement(eS, 0, 0).moveByOffset(520, 255).click().build().perform(); Thread.sleep(1000); driver.findElement(By.id("accordion")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Ground Mount"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"2\"]")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Sloped Roof"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"0\"]")).click(); //// // driver.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")).click(); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .clear(); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .sendKeys("52"); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .click(); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .clear(); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .sendKeys("18"); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .click(); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .clear(); driver .findElement( By.xpath( "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")) .sendKeys("45"); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Sloped Roof"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"0\"]")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click(); driver.findElement(By.id("mountTypeRegion1")).click(); new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Ground Mount"); driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"2\"]")).click(); driver.findElement(By.cssSelector("label.overTxtLabel")).click(); driver.findElement(By.id("proposalName")).sendKeys("AUTOMATION TEST"); driver.findElement(By.id("regionsPaneTitle")).click(); driver.findElement(By.id("regionsPaneTitle")).click(); Thread.sleep(500); /// driver.findElement(By.id("squareUpButton2")).click(); driver.findElement(By.xpath("//input[@id='snapAzimuthButton1']")).click(); driver.findElement(By.xpath("//input[@id='applySetbacksButton1']")).click(); /// assertEquals("Setbacks cannot be less than zero.", closeAlertAndGetItsText()); //// driver.findElement(By.id("delPolygonButton2")).click(); Thread.sleep(1000); /// driver.findElement(By.id("squareUpButton3")).click(); /// driver.findElement(By.id("squareUpButton3")).click(); driver.findElement(By.id("accordion")).click(); driver.findElement(By.cssSelector("div[title=\"Pan up\"]")).click(); driver.findElement(By.cssSelector("div[title=\"Pan right\"]")).click(); driver.findElement(By.cssSelector("div[title=\"Pan down\"]")).click(); driver.findElement(By.cssSelector("div[title=\"Pan left\"]")).click(); driver.findElement(By.cssSelector("div[title=\"Zoom out\"] > img")).click(); driver.findElement(By.cssSelector("div[title=\"Zoom in\"] > img")).click(); driver.findElement(By.id("accordion")).click(); ///// ///// //// /// no need driver.findElement(By.xpath("//div[@id='solutionCategory']/ul/li[2]/h3")).click(); /// no need driver.findElement(By.cssSelector("span.arrow")).click(); driver.findElement(By.xpath("//input[@value='Next']")).click(); driver.findElement(By.id("accordion")).click(); driver.findElement(By.id("accordionTitleText")).click(); driver.findElement(By.id("accordion")).click(); driver.findElement(By.id("nextButton")).click(); driver.findElement(By.id("accordion")).click(); driver.findElement(By.id("contentUsagePaneTitle")).click(); driver.findElement(By.id("accordion")).click(); Thread.sleep(1000); // click on Inverters driver.findElement(By.xpath("//h3[text()= 'Inverters']")).click(); // Click on Arrow driver.findElement(By.xpath("//span[@class = 'arrow']")).click(); Thread.sleep(1000); // Default Invert select driver.findElement(By.xpath("html/body/ul/li[2]/span")).click(); // Click on Arrow driver.findElement(By.xpath("//span[@class = 'arrow']")).click(); Thread.sleep(2000); // Click on Next button driver.findElement(By.xpath("//input[@value='Next']")).click(); Thread.sleep(2000); ////// errror--- driver.findElement(By.id("supplyLeadDetailsBtn1")).click(); driver.findElement(By.id("accordion")).click(); ///// driver.findElement(By.id("accordion")).click(); ////// driver.findElement(By.id("accordion")).click(); Thread.sleep(1500); ///// driver.findElement(By.id("backBtn")).click(); //// driver.findElement(By.cssSelector("label > input[type=\"button\"]")).click(); // Click on Next button driver.findElement(By.xpath("//input[@id='nextButton']")).click(); /// PREVIEW PAGE STARTS HERE Thread.sleep(2000); driver.findElement(By.id("accordion")).click(); Thread.sleep(250); driver.findElement(By.cssSelector("#buyForCashCheckbox")).click(); Thread.sleep(250); driver.findElement(By.cssSelector("#nextButton")).click(); Thread.sleep(1000); // ERROR: Caught exception [unknown command []] }
@Test public void testVip7day() throws Exception { driver .manage() .timeouts() .implicitlyWait(30, TimeUnit.SECONDS); // неявное ожидание при каждом поиске элементов driver.get("http://mylove.ru"); driver.findElement(By.id("mprofile_link")).click(); driver.findElement(By.cssSelector("#isvip")).click(); if (isElementPresent(By.xpath("//*[@id='settings']"))) { driver.findElement(By.xpath("//*[@id='settings']//a[contains(@class,'techbutton')]")).click(); } Pattern pat = Pattern.compile("[-]?[0-9]+(.[0-9]+)?"); // String Str1= driver.findElement(By.cssSelector("div.vipend > i")).getText(); String Str1 = driver .findElement( By.cssSelector("#body > div.window.pay_window > div > div.paymay > div.vipend > i")) .getText(); Matcher matcher1 = pat.matcher(Str1); while (matcher1.find()) Str1 = matcher1.group(); // что-то происходит Str1 = Str1.replaceAll(" ", ""); Integer i1 = Integer.valueOf(Str1); // driver.findElement(By.xpath("//*[@id=\"vip_settings\"]/div[2]/a[1]")).click(); тоже верно driver.findElement(By.cssSelector("#vip_settings div.pcols > a")).click(); Thread.sleep( 1000); /// без ожидания не успевает измениться выбранное значение дней, потом заменить на // явное ожидание с условием driver .findElement(By.cssSelector("div.pay_variant.pay_bill.pay_variant_cash > a")) .click(); // Платим со счета WebDriverWait wait = new WebDriverWait(driver, 20); wait.until( ExpectedConditions.stalenessOf( driver.findElement( By.cssSelector( "#isvip")))); // подождем когда какой то DOM исчезнет(( чтобы посмотреть сколько // теперь дней до окончания випа, долго работает driver.findElement(By.cssSelector("#isvip")).click(); driver.findElement(By.xpath("//*[@id='settings']//a[contains(@class,'techbutton')]")).click(); String Str2 = driver.findElement(By.cssSelector("div.vipend > i")).getText(); Matcher matcher2 = pat.matcher(Str2); while (matcher2.find()) Str2 = matcher2.group(); Str2 = Str2.replaceAll(" ", ""); // если дней больше 1000 то строка с пробелами Integer i2 = Integer.valueOf(Str2); i1 = i1 + 7; // Проверим что количество дней випа увеличилось на 7 assertEquals(i2, i1); };
@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; } }
// *** 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(); }