// Method checking if the edited profile is displayed back to the user and if illegal string like // URL and email id are stripped off from "profile essay" sections private void verifyChanges() { List<WebElement> allElements = driver.findElements(By.cssSelector("div[id='about_myself'] p")); for (WebElement element1 : allElements) { if (element1.getText().contains("www.") || element1.getText().contains(".com")) ; ripOffTextAboutMe++; } List<WebElement> allElements2 = driver.findElements(By.cssSelector("div[id='who_im_looking_for'] p")); for (WebElement element2 : allElements2) { if (element2.getText().contains("www.") || element2.getText().contains(".com")) ; ripOffTextPartnerSearch++; } List<WebElement> allElement3 = driver.findElements(By.cssSelector("ul[class='profileInformation'] li")); for (WebElement element3 : allElement3) { // System.out.println(element3.getText()); if (element3.getText().contains("Mixed") || element3.getText().contains("4ft. 10in.")) profileChangeCheck++; } if (profileChangeCheck > 0) System.out.println("SUCCESS: The changes made in the basic profile are visible"); if (ripOffTextAboutMe != 0) System.out.println( "SUCCESS: The About Myself section has ripped off any illegal strings like URL and Email id"); if (ripOffTextPartnerSearch != 0) System.out.println( "SUCCESS: The What I am Looking For section has ripped off any illegal strings like URL and Email id"); }
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 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 testSearchFeature() { // find search, check if search works by sending a search time, see that results exist WebElement element = driver.findElement(By.name("search_block_form")); element.sendKeys("Laboon"); element.sendKeys(Keys.RETURN); assert (driver.findElement(By.name("Laboon")) != null); // is it good enough? }
/* Given: Logged into a valid account When: I look at the navigation bar Then: I will see a link for my user profile */ @Test public void testProfile(){ driver.findElement(By.id("navbar_username")).clear(); driver.findElement(By.id("navbar_username")).sendKeys("Aytros"); driver.findElement(By.id("navbar_password")).clear(); driver.findElement(By.id("navbar_password")).sendKeys("Mystra@428"); driver.findElement(By.value("Log in")).click(); String test = driver.findElement(By.linkText("Aytros")).getAttribute("title"); assertTrue(test.contains("Profile")); }
@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(expected = TimeoutException.class) public void shouldTimeoutWhileChangingIframeSource() { final String iFrameId = "iframeId"; // Define HTTP response for test server.setGetHandler( new HttpRequestCallback() { @Override public void call(HttpServletRequest req, HttpServletResponse res) throws IOException { String pathInfo = req.getPathInfo(); ServletOutputStream out = res.getOutputStream(); if (pathInfo.endsWith("iframe_content.html")) { // nested frame 1 out.println("iframe content"); } else { // main page out.println( "<html>\n" + "<body>\n" + " <iframe id='" + iFrameId + "'></iframe>\n" + " <script>\n" + " setTimeout(function() {\n" + " document.getElementById('" + iFrameId + "').src='iframe_content.html';\n" + " }, 2000);\n" + " </script>\n" + "</body>\n" + "</html>"); } } }); // Launch Driver against the above defined server WebDriver d = getDriver(); d.get(server.getBaseUrl()); // Switch to iframe d.switchTo().frame(iFrameId); assertEquals(0, d.findElements(By.id(iFrameId)).size()); assertFalse(d.getPageSource().toLowerCase().contains("iframe content")); new WebDriverWait(d, 5) .until( new Predicate<WebDriver>() { @Override public boolean apply(@Nullable WebDriver driver) { assertEquals(0, driver.findElements(By.id(iFrameId)).size()); return (Boolean) ((JavascriptExecutor) driver).executeScript("return false;"); } }); }
@Before public void setUp() throws Exception { driver = new FirefoxDriver(); func = new COTFunctions(driver); driver.manage().timeouts().implicitlyWait(func.timeoutOFAllElement, TimeUnit.SECONDS); driver.get(func.baseUrl + "/"); func.CheckLogin(); func.LoginRole("SchoolAdmin"); driver.get(func.baseUrl + "/college-search"); }
@Before public void setUp() throws Exception { driver = new FirefoxDriver(); func = new COTFunctions(driver); wait = new WebDriverWait(driver, func.timeoutOfOneElement); driver.manage().timeouts().implicitlyWait(func.timeoutOFAllElement, TimeUnit.SECONDS); driver.get(func.baseUrl + "/"); func.CheckLogin(); func.LoginRole("Student"); driver.get(func.baseUrl + "/document-locker"); }
@Test public void switchToFrameByName() { WebDriver d = getDriver(); d.get("http://docs.wpm.neustar.biz/testscript-api/index.html"); assertEquals("__MAIN_FRAME__", getCurrentFrameName(d)); d.switchTo().frame("packageFrame"); assertEquals("packageFrame", getCurrentFrameName(d)); d.switchTo().defaultContent(); assertEquals("__MAIN_FRAME__", getCurrentFrameName(d)); d.switchTo().frame("packageFrame"); assertEquals("packageFrame", getCurrentFrameName(d)); }
@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 TypesOfSchool() throws IOException { // Click Type of School driver.findElement(By.cssSelector("strong")).click(); // Click Private driver.findElement(By.id("edit-public-private-private")).click(); // Move School Size Slider // TODO Slider not working properly WebElement Slider1 = driver.findElement(By.id("population_jq_slider")); Actions moveSlider1 = new Actions(driver); Action action1 = moveSlider1.dragAndDropBy(Slider1, 0, 10).build(); action1.perform(); // Select Religious Affiliation new Select(driver.findElement(By.id("edit-religious-affiliation"))) .selectByVisibleText("Church of Christ"); // Move Tuition Range Slider // TODO Slider not working properly WebElement Slider2 = driver.findElement(By.id("tuition_range_jq_slider")); Actions moveSlider2 = new Actions(driver); Action action2 = moveSlider2.dragAndDropBy(Slider2, 0, 10).build(); action2.perform(); // Click Apply driver.findElement(By.id("edit-type-of-school-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 pageSourceShouldReturnSourceOfFocusedFrame() throws InterruptedException { WebDriver d = getDriver(); d.get("http://docs.wpm.neustar.biz/testscript-api/index.html"); // Compare source before and after the frame switch String pageSource = d.getPageSource(); d.switchTo().frame("classFrame"); String framePageSource = d.getPageSource(); assertFalse(pageSource.equals(framePageSource)); assertTrue( "Page source was: " + framePageSource, framePageSource.contains("Interface Summary")); }
@Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http://in.reuters.com/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.manage().window().maximize(); }
// *** 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(); }
@Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http://bibliotecautn.sytes.net"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); Utilidades.seleniumLogin(driver, baseUrl); }
private void SearchButton() throws IOException { // Enter Text To Be Search driver.findElement(By.id("edit-keys")).clear(); driver.findElement(By.id("edit-keys")).sendKeys("Abilene"); // Click Search driver.findElement(By.id("edit-submit")).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 shouldBeAbleToSwitchToIFrameThatHasNoNameNorId() { server.setGetHandler( new HttpRequestCallback() { @Override public void call(HttpServletRequest req, HttpServletResponse res) throws IOException { res.getOutputStream() .println("<html>" + "<body>" + " <iframe></iframe>" + "</body>" + "</html>"); } }); WebDriver d = getDriver(); d.get(server.getBaseUrl()); WebElement el = d.findElement(By.tagName("iframe")); d.switchTo().frame(el); }
@Test(expected = NoSuchElementException.class) public void shouldBeAbleToClickInAFrameAfterRunningJavaScript() throws InterruptedException { WebDriver d = getDriver(); // Navigate to page and ensure we are on the Main Frame d.get("http://docs.wpm.neustar.biz/testscript-api/index.html"); assertEquals("__MAIN_FRAME__", getCurrentFrameName(d)); assertTrue(isAtTopWindow(d)); d.switchTo().defaultContent(); assertEquals("__MAIN_FRAME__", getCurrentFrameName(d)); assertTrue(isAtTopWindow(d)); // Switch to a child frame d.switchTo().frame("classFrame"); assertEquals("classFrame", getCurrentFrameName(d)); assertFalse(isAtTopWindow(d)); // Renavigate to the page, and check we are back on the Main Frame d.get("http://docs.wpm.neustar.biz/testscript-api/index.html"); assertEquals("__MAIN_FRAME__", getCurrentFrameName(d)); assertTrue(isAtTopWindow(d)); // Switch to a child frame d.switchTo().frame("classFrame"); assertEquals("classFrame", getCurrentFrameName(d)); assertFalse(isAtTopWindow(d)); // This should cause a reload in the frame "classFrame" d.findElement(By.linkText("HttpClient")).click(); // Wait for new content to load in the frame. WebDriverWait wait = new WebDriverWait(d, 10); wait.until(ExpectedConditions.titleContains("HttpClient")); // Frame should still be "classFrame" assertEquals("classFrame", getCurrentFrameName(d)); // Check if a link "clearCookies()" is there where expected assertEquals("clearCookies", d.findElement(By.linkText("clearCookies")).getText()); // Make sure it was really frame "classFrame" which was replaced: // 1. move to the other frame "packageFrame" d.switchTo().defaultContent().switchTo().frame("packageFrame"); assertEquals("packageFrame", getCurrentFrameName(d)); // 2. the link "clearCookies()" shouldn't be there anymore d.findElement(By.linkText("clearCookies")); }
private boolean isAlertPresent() { try { driver.switchTo().alert(); return true; } catch (NoAlertPresentException e) { return false; } }
@After public void tearDown() throws Exception { driver.quit(); String verificationErrorString = verificationErrors.toString(); if (!"".equals(verificationErrorString)) { fail(verificationErrorString); } }
private boolean isElementPresent(By by) { try { driver.findElement(by); return true; } catch (NoSuchElementException e) { return false; } }
// 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); } }
@Before public void setUp() throws Exception { System.setProperty( "webdriver.chrome.driver", "C:\\Users\\om\\Downloads\\Programs\\Selenium\\chromedriver.exe"); driver = new ChromeDriver(); baseUrl = "http://collegeontrackdev.prod.acquia-sites.com/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); }
@Before public void setUp() throws Exception { driver = new FirefoxDriver(); recorder = new Recorder(); baseUrl = "http://10.0.0.107:8080/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.manage().window().maximize(); recorder.startRecording(this.getClass().getName()); }
@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()); } }
// *** 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(); }
private WebElement findElement(final By locator) { (new WebDriverWait(driver, 30, 1000)) .until(ExpectedConditions.presenceOfElementLocated(locator)); (new WebDriverWait(driver, 30, 1000)) .until(ExpectedConditions.visibilityOfElementLocated(locator)); WebElement element = driver.findElement(locator); if (element.isEnabled() == false) ((JavascriptExecutor) driver).executeScript("arguments[0].disabled = false", element); return element; }
@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(); }
@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")); }