List of usage examples for org.openqa.selenium By id
public static By id(String id)
From source file:at.tugraz.ist.catroweb.catroid.ProfileTests.java
License:Open Source License
@Test(dataProvider = "emailTest", groups = { "functionality", "visibility" }, description = "Tests user profile page") public void profileForeignProfilePage(HashMap<String, String> dataset) throws Throwable { try {/* w ww .ja v a 2s . c o m*/ openLocation("registration/"); driver().findElement(By.id("registrationUsername")).sendKeys(dataset.get("registrationUsername")); driver().findElement(By.id("registrationPassword")).sendKeys(dataset.get("registrationPassword")); driver().findElement(By.id("registrationEmail")).sendKeys(dataset.get("registrationEmail")); (new Select(driver().findElement(By.id("registrationCountry")))) .selectByValue(dataset.get("registrationCountryID")); driver().findElement(By.id("registrationMonth")).sendKeys(dataset.get("registrationMonth")); driver().findElement(By.id("registrationYear")).sendKeys(dataset.get("registrationYear")); driver().findElement(By.id("registrationGender")).sendKeys(dataset.get("registrationGender")); driver().findElement(By.id("registrationSubmit")).click(); ajaxWait(); logout("profile/" + dataset.get("registrationUsername")); // not logged in, view foreign profile assertFalse(isElementPresent(By.id("profileNewPassword"))); assertFalse(isElementPresent(By.id("profileRepeatPassword"))); assertFalse(isElementPresent(By.id("profileCountry"))); assertFalse(isElementPresent(By.id("profileEmail"))); assertFalse(isElementPresent(By.id("profileSecondEmail"))); assertFalse(isElementPresent(By.id("profileSaveChanges"))); assertFalse(isTextPresent("MY PROJECTS")); assertTrue(isTextPresent("PROJECTS OF " + dataset.get("registrationUsername").toUpperCase())); assertFalse(isElementPresent(By.id("registrationSubmit"))); assertFalse(isTextPresent("Login".toUpperCase())); assertTrue(isTextPresent(dataset.get("registrationUsername").toUpperCase())); // /profile/ without username should redirect to login page when not logged in openLocation("profile/"); assertTrue(isTextPresent("Login".toUpperCase())); login("profile/" + dataset.get("registrationUsername")); // logged in as catroweb, view foreign profile assertTrue(isTextPresent(dataset.get("registrationUsername").toUpperCase())); assertTrue(isTextPresent(dataset.get("registrationCountry"))); assertTrue(isTextPresent("0")); assertFalse(isElementPresent(By.id("profileNewPassword"))); assertFalse(isElementPresent(By.id("profileRepeatPassword"))); assertFalse(isElementPresent(By.id("profileCountry"))); assertFalse(isElementPresent(By.id("profileEmail"))); assertFalse(isElementPresent(By.id("profileSecondEmail"))); assertFalse(isElementPresent(By.id("profileSaveChanges"))); assertFalse(isTextPresent("MY PROJECTS")); assertTrue(isTextPresent("PROJECTS OF " + dataset.get("registrationUsername").toUpperCase())); assertFalse(isElementPresent(By.id("registrationSubmit"))); assertFalse(isTextPresent("Login".toUpperCase())); assertTrue(isTextPresent(dataset.get("registrationUsername").toUpperCase())); String projectTitle = dataset.get("registrationUsername"); String authToken = CommonFunctions.getAuthenticationToken(dataset.get("registrationUsername")); projectUploader.upload(CommonData.getUploadPayload(projectTitle, "", "", "", "", "", dataset.get("registrationUsername"), authToken)); assertProjectPresent(projectTitle); openLocation("profile/" + dataset.get("registrationUsername")); assertTrue(isTextPresent("1")); // /profile/ without username should show own profile when logged in openLocation("profile/"); assertFalse(isTextPresent("Login".toUpperCase())); assertFalse(isTextPresent(dataset.get("registrationUsername").toUpperCase())); assertTrue(isTextPresent(CommonData.getLoginUserDefault().toUpperCase())); assertTrue(isElementPresent(By.id("profileNewPassword"))); assertTrue(isElementPresent(By.id("profileRepeatPassword"))); assertTrue(isElementPresent(By.xpath("/html/body/div/article/div/div[2]/div/div[4]/select"))); assertTrue(isElementPresent(By.id("profileEmail"))); assertTrue(isElementPresent(By.id("profileSecondEmail"))); assertTrue(isElementPresent(By.id("profileSaveChanges"))); assertTrue(isTextPresent("MY PROJECTS")); assertTrue(isElementPresent(By.id("profileSaveChanges"))); CommonFunctions.deleteUserFromDatabase(dataset.get("registrationUsername")); } catch (AssertionError e) { CommonFunctions.deleteUserFromDatabase(dataset.get("registrationUsername")); captureScreen("ProfileTests.profileForeignProfilePage." + dataset.get("registrationUsername")); throw e; } catch (Exception e) { CommonFunctions.deleteUserFromDatabase(dataset.get("registrationUsername")); captureScreen("ProfileTests.profileForeignProfilePage." + dataset.get("registrationUsername")); throw e; } }
From source file:at.tugraz.ist.catroweb.catroid.RegistrationTests.java
License:Open Source License
@Test(groups = { "visibility" }, description = "check expected elements are visible and texts are present") public void checkElementsVisibleAndTextPresent() throws Throwable { try {//from ww w . j ava 2s . c o m openLocation("registration/"); assertTrue(isTextPresent(CommonStrings.REGISTRATION_PAGE_TITLE.toUpperCase())); assertTrue(isTextPresent(CommonStrings.REGISTRATION_NICKNAME)); assertTrue(isElementPresent(By.id("registrationUsername"))); assertTrue(isTextPresent(CommonStrings.REGISTRATION_NICKNAME_INFO)); assertTrue(isTextPresent(CommonStrings.REGISTRATION_PASSWORD)); assertTrue(isElementPresent(By.id("registrationPassword"))); assertTrue(isTextPresent(CommonStrings.REGISTRATION_EMAIL)); assertTrue(isElementPresent(By.id("registrationEmail"))); assertTrue(isTextPresent(CommonStrings.REGISTRATION_EMAIL_INFO)); assertTrue(isTextPresent(CommonStrings.REGISTRATION_COUNTRY)); assertTrue(isElementPresent(By.id("registrationCountry"))); assertTrue(isTextPresent(CommonStrings.REGISTRATION_CITY)); assertTrue(isElementPresent(By.id("registrationCity"))); assertTrue(isTextPresent(CommonStrings.REGISTRATION_BIRTHDAY)); assertTrue(isElementPresent(By.id("registrationMonth"))); assertTrue(isElementPresent(By.id("registrationYear"))); assertTrue(isTextPresent(CommonStrings.REGISTRATION_GENDER)); assertTrue(isElementPresent(By.id("registrationGender"))); assertTrue((driver().findElement(By.id("registrationSubmit"))).getText() .contains(CommonStrings.REGISTRATION_SUBMIT.toUpperCase())); assertTrue(isElementPresent(By.id("registrationSubmit"))); assertTrue(isTextPresent(CommonStrings.REGISTRATION_LOGIN)); assertTrue(isElementPresent(By.id("registrationLogin"))); assertTrue(isTextPresent(CommonStrings.REGISTRATION_FORGOT_PWD)); assertTrue(isElementPresent(By.id("forgotPassword"))); } catch (AssertionError e) { captureScreen("RegistrationTests.checkElementsVisible." + CommonFunctions.getTimeStamp()); throw e; } catch (Exception e) { captureScreen("RegistrationTests.checkElementsVisible." + CommonFunctions.getTimeStamp()); throw e; } }
From source file:at.tugraz.ist.catroweb.catroid.RegistrationTests.java
License:Open Source License
@Test(dataProvider = "triggerErrorsData", groups = { "functionality" }, description = "trigger all error messages and check whether they present") public void checkErrorMessages(HashMap<String, String> dataset) throws Throwable { try {// w w w . j av a 2 s . co m openLocation("registration/"); driver().findElement(By.id("registrationUsername")).sendKeys(dataset.get("registrationUsername")); driver().findElement(By.id("registrationPassword")).sendKeys(dataset.get("registrationPassword")); driver().findElement(By.id("registrationEmail")).sendKeys(dataset.get("registrationEmail")); driver().findElement(By.id("registrationCountry")).sendKeys(dataset.get("registrationCountry")); driver().findElement(By.id("registrationMonth")).sendKeys(dataset.get("registrationMonth")); driver().findElement(By.id("registrationYear")).sendKeys(dataset.get("registrationYear")); driver().findElement(By.id("registrationGender")).sendKeys(dataset.get("registrationGender")); driver().findElement(By.id("registrationSubmit")).click(); Alert alert = driver().switchTo().alert(); String message = alert.getText().replace("<", "<").replace(">", ">"); alert.accept(); assertTrue(message.contains(dataset.get("expectedError"))); } catch (AssertionError e) { captureScreen("RegistrationTests.checkElementsVisible." + CommonFunctions.getTimeStamp()); throw e; } catch (Exception e) { captureScreen("RegistrationTests.checkElementsVisible." + CommonFunctions.getTimeStamp()); throw e; } }
From source file:at.tugraz.ist.catroweb.catroid.RegistrationTests.java
License:Open Source License
@Test(dataProvider = "validRegistrationData", groups = { "functionality" }, description = "check registration with valid data") public void validRegistration(HashMap<String, String> dataset) throws Throwable { try {/* w w w .j a v a2 s. c o m*/ openLocation("registration/"); driver().findElement(By.id("registrationUsername")).sendKeys(dataset.get("registrationUsername")); driver().findElement(By.id("registrationPassword")).sendKeys(dataset.get("registrationPassword")); driver().findElement(By.id("registrationEmail")).sendKeys(dataset.get("registrationEmail")); driver().findElement(By.id("registrationCountry")).sendKeys(dataset.get("registrationCountry")); driver().findElement(By.id("registrationCity")).sendKeys(dataset.get("registrationCity")); driver().findElement(By.id("registrationMonth")).sendKeys(dataset.get("registrationMonth")); driver().findElement(By.id("registrationYear")).sendKeys(dataset.get("registrationYear")); driver().findElement(By.id("registrationGender")).sendKeys(dataset.get("registrationGender")); driver().findElement(By.id("registrationSubmit")).click(); ajaxWait(); assertTrue(isTextPresent(dataset.get("registrationUsername"))); CommonFunctions.deleteUserFromDatabase(dataset.get("registrationUsername")); } catch (AssertionError e) { captureScreen("RegistrationTests.validRegistration." + CommonFunctions.getTimeStamp()); log("RegistrationTests.validRegistration.: " + dataset.get("registrationUsername")); throw e; } catch (Exception e) { captureScreen("RegistrationTests.validRegistration." + CommonFunctions.getTimeStamp()); log("RegistrationTests.validRegistration.: " + dataset.get("registrationUsername")); throw e; } }
From source file:at.tugraz.ist.catroweb.catroid.RegistrationTests.java
License:Open Source License
@Test(dataProvider = "invalidRegistrationData", groups = { "functionality", "popupwindows" }, description = "check registration with invalid data") public void invalidRegistration(HashMap<String, String> dataset) throws Throwable { try {//www.j a v a 2s . c o m // wiki username creation String wikiUsername = dataset.get("registrationUsername").substring(0, 1).toUpperCase() + dataset.get("registrationUsername").substring(1).toLowerCase(); openLocation("registration/"); driver().findElement(By.id("registrationUsername")).sendKeys(dataset.get("registrationUsername")); driver().findElement(By.id("registrationPassword")).sendKeys(dataset.get("registrationPassword")); driver().findElement(By.id("registrationEmail")).sendKeys(dataset.get("registrationEmail")); driver().findElement(By.id("registrationMonth")).sendKeys(dataset.get("registrationMonth")); driver().findElement(By.id("registrationYear")).sendKeys(dataset.get("registrationYear")); driver().findElement(By.id("registrationGender")).sendKeys(dataset.get("registrationGender")); driver().findElement(By.id("registrationCountry")).sendKeys(dataset.get("registrationCountry")); driver().findElement(By.id("registrationCity")).sendKeys(dataset.get("registrationCity")); driver().findElement(By.id("registrationSubmit")).click(); Alert alert = driver().switchTo().alert(); String message = alert.getText().replace("<", "<").replace(">", ">"); alert.accept(); assertTrue(message.contains(dataset.get("expectedError"))); } catch (AssertionError e) { captureScreen("RegistrationTests.invalidRegistration." + dataset.get("registrationUsername")); throw e; } catch (Exception e) { captureScreen("RegistrationTests.invalidRegistration." + dataset.get("registrationUsername")); throw e; } }
From source file:at.tugraz.ist.catroweb.catroid.ReportAsInappropriateTests.java
License:Open Source License
@Test(dataProvider = "loginDataAndReportOwnProject", groups = { "functionality", "upload" }, description = "login and report own project as inappropriate") public void reportOwnProjectAsInappropriate(HashMap<String, String> dataset) throws Throwable { try {//ww w . j av a 2 s .c o m // upload project Random rand = new Random(); String projectTitle = "Testproject_for_report_as_inappropriate_" + rand.nextInt(9999); String response = projectUploader .upload(CommonData.getUploadPayload(projectTitle, dataset.get("projectDescription"), "", "", "", "", dataset.get("username"), dataset.get("token"))); assertEquals("200", CommonFunctions.getValueFromJSONobject(response, "statusCode")); String projectId = CommonFunctions.getValueFromJSONobject(response, "projectId"); // goto details page login("details/" + projectId); assertTrue(isTextPresent(projectTitle.toUpperCase())); assertTrue(isTextPresent(dataset.get("projectDescription"))); // report as inappropriate visible assertTrue(isElementPresent(By.id("reportAsInappropriateButton"))); // check if reportAsInappropriate button is visible for a foreign project openLocation("details/1"); ajaxWait(); assertTrue(isElementPresent(By.id("reportAsInappropriateButton"))); logout("details/" + projectId); assertTrue(isTextPresent(projectTitle.toUpperCase())); assertTrue(isTextPresent(dataset.get("projectDescription"))); // report as inappropriate still visible after logout assertTrue(isElementPresent(By.id("reportAsInappropriateButton"))); } catch (AssertionError e) { captureScreen("ReportAsInappropriateTests.reportOwnProjectAsInappropriate"); throw e; } catch (Exception e) { captureScreen("ReportAsInappropriateTests.reportOwnProjectAsInappropriate"); throw e; } }
From source file:at.tugraz.ist.catroweb.catroid.SearchTests.java
License:Open Source License
@Test(dataProvider = "randomProjects", groups = { "functionality", "upload" }, description = "search for random title and description") public void titleAndDescription(HashMap<String, String> dataset) throws Throwable { try {/*from w ww . ja v a 2 s . co m*/ projectUploader.upload(dataset); String projectTitle = dataset.get("projectTitle"); String projectDescription = dataset.get("projectDescription"); openLocation("search/?q=" + projectTitle + "&p=1"); ajaxWait(); assertTrue(isTextPresent(CommonStrings.SEARCH_PROJECTS_PAGE_TITLE.toUpperCase())); assertTrue(isElementPresent(By.xpath("//a[@title=\"" + projectTitle + "\"]"))); // test description driver().findElement(By.xpath("//*[@id='largeMenu']/div[4]/input")).clear(); driver().findElement(By.xpath("//*[@id='largeMenu']/div[4]/input")).sendKeys(projectDescription); driver().findElement(By.id("largeSearchButton")).click(); ajaxWait(); assertTrue(isTextPresent(CommonStrings.SEARCH_PROJECTS_PAGE_TITLE.toUpperCase())); assertTrue(isElementPresent(By.xpath("//a[@title=\"" + projectTitle + "\"]"))); } catch (AssertionError e) { captureScreen("SearchTests.titleAndDescription." + dataset.get("projectTitle")); log(dataset.get("projectTitle")); log(dataset.get("projectDescription")); throw e; } catch (Exception e) { captureScreen("SearchTests.titleAndDescription." + dataset.get("projectTitle")); throw e; } }
From source file:at.tugraz.ist.catroweb.catroid.SearchTests.java
License:Open Source License
@Test(groups = { "functionality" }, description = "checks all search boxes and buttons") public void searchBoxesAndButton() throws Throwable { try {/*from ww w.j a va 2 s. co m*/ String projectTitleA = "searchFunctionalityA" + CommonData.getRandomShortString(22); projectUploader.upload(CommonData.getUploadPayload(projectTitleA, CommonData.getRandomLongString(200), "", "", "", "", "", "")); String projectTitleB = "searchFunctionalityA" + CommonData.getRandomShortString(22); projectUploader.upload(CommonData.getUploadPayload(projectTitleB, CommonData.getRandomLongString(200), "", "", "", "", "", "")); By largeTopSearchBox = By.xpath("//*[@id='largeMenu']/div[4]/input"); By largeFooterSearchBox = By.xpath("//*[@id='largeFooterMenu']/div[2]/span[2]/input"); By mobileSearchBox = By.xpath("//*[@id='smallSearchBar']/input"); // large layout search bar on the top openLocation(); assertTrue(isVisible(By.id("largeSearchButton"))); assertTrue(isVisible(largeTopSearchBox)); driver().findElement(largeTopSearchBox).sendKeys(projectTitleA); driver().findElement(largeTopSearchBox).sendKeys(Keys.RETURN); ajaxWait(); assertTrue(isElementPresent(By.xpath("//a[@title=\"" + projectTitleA + "\"]"))); assertFalse(isElementPresent(By.xpath("//a[@title=\"" + projectTitleB + "\"]"))); driver().findElement(largeTopSearchBox).clear(); driver().findElement(largeTopSearchBox).sendKeys(projectTitleB); driver().findElement(largeTopSearchBox).sendKeys(Keys.RETURN); ajaxWait(); assertFalse(isElementPresent(By.xpath("//a[@title=\"" + projectTitleA + "\"]"))); assertTrue(isElementPresent(By.xpath("//a[@title=\"" + projectTitleB + "\"]"))); openLocation(); driver().findElement(largeTopSearchBox).sendKeys(projectTitleA); driver().findElement(By.id("largeSearchButton")).click(); ajaxWait(); assertTrue(isElementPresent(By.xpath("//a[@title=\"" + projectTitleA + "\"]"))); driver().findElement(largeTopSearchBox).clear(); driver().findElement(largeTopSearchBox).sendKeys(projectTitleB); driver().findElement(By.id("largeSearchButton")).click(); ajaxWait(); assertFalse(isElementPresent(By.xpath("//a[@title=\"" + projectTitleA + "\"]"))); assertTrue(isElementPresent(By.xpath("//a[@title=\"" + projectTitleB + "\"]"))); // large layout search bar on the bottom openLocation(); assertTrue(isVisible(By.id("footerSearchButton"))); assertTrue(isVisible(largeFooterSearchBox)); driver().findElement(largeFooterSearchBox).sendKeys(projectTitleA); driver().findElement(largeFooterSearchBox).sendKeys(Keys.RETURN); ajaxWait(); assertTrue(isElementPresent(By.xpath("//a[@title=\"" + projectTitleA + "\"]"))); assertFalse(isElementPresent(By.xpath("//a[@title=\"" + projectTitleB + "\"]"))); driver().findElement(largeFooterSearchBox).clear(); driver().findElement(largeFooterSearchBox).sendKeys(projectTitleB); driver().findElement(largeFooterSearchBox).sendKeys(Keys.RETURN); ajaxWait(); assertFalse(isElementPresent(By.xpath("//a[@title=\"" + projectTitleA + "\"]"))); assertTrue(isElementPresent(By.xpath("//a[@title=\"" + projectTitleB + "\"]"))); openLocation(); driver().findElement(largeFooterSearchBox).sendKeys(projectTitleA); driver().findElement(By.id("footerSearchButton")).click(); ajaxWait(); assertTrue(isElementPresent(By.xpath("//a[@title=\"" + projectTitleA + "\"]"))); driver().findElement(largeFooterSearchBox).clear(); driver().findElement(largeFooterSearchBox).sendKeys(projectTitleB); driver().findElement(By.id("footerSearchButton")).click(); ajaxWait(); assertFalse(isElementPresent(By.xpath("//a[@title=\"" + projectTitleA + "\"]"))); assertTrue(isElementPresent(By.xpath("//a[@title=\"" + projectTitleB + "\"]"))); // mobile layout search bar on the top openMobileLocation(); assertTrue(isVisible(By.id("mobileSearchButton"))); assertFalse(isVisible(mobileSearchBox)); driver().findElement(By.id("mobileSearchButton")).click(); driver().findElement(mobileSearchBox).sendKeys(projectTitleA); driver().findElement(mobileSearchBox).sendKeys(Keys.RETURN); ajaxWait(); assertTrue(isElementPresent(By.xpath("//a[@title=\"" + projectTitleA + "\"]"))); assertFalse(isElementPresent(By.xpath("//a[@title=\"" + projectTitleB + "\"]"))); driver().findElement(mobileSearchBox).clear(); driver().findElement(mobileSearchBox).sendKeys(projectTitleB); driver().findElement(mobileSearchBox).sendKeys(Keys.RETURN); ajaxWait(); assertFalse(isElementPresent(By.xpath("//a[@title=\"" + projectTitleA + "\"]"))); assertTrue(isElementPresent(By.xpath("//a[@title=\"" + projectTitleB + "\"]"))); } catch (AssertionError e) { captureScreen("SearchTests.searchBoxesAndButton"); throw e; } catch (Exception e) { captureScreen("SearchTests.searchBoxesAndButton"); throw e; } }
From source file:at.tugraz.ist.catroweb.catroid.SearchTests.java
License:Open Source License
@Test(dataProvider = "specialChars", groups = { "functionality", "upload" }, description = "search forspecial chars") public void specialChars(String specialchars) throws Throwable { try {/*from w ww .j av a 2 s. c o m*/ String projectPrefix = "searchtest" + CommonData.getRandomShortString(10); String projectTitle = projectPrefix + specialchars; String htmlProjectTitle = projectTitle.replace("&", "&").replace("\"", """); projectUploader.upload(CommonData.getUploadPayload(projectTitle, CommonData.getRandomLongString(200), "", "", "", "", "", "")); openLocation(); ajaxWait(); By searchBox = By.xpath("//*[@id='largeMenu']/div[4]/input"); for (int i = projectTitle.length() - specialchars.length(); i < projectTitle.length(); i++) { driver().findElement(searchBox).clear(); driver().findElement(searchBox) .sendKeys(projectPrefix + projectTitle.substring(projectPrefix.length(), i + 1)); driver().findElement(By.id("largeSearchButton")).click(); ajaxWait(); assertTrue(isElementPresent(By.xpath("//a[@title=\"" + htmlProjectTitle + "\"]"))); driver().findElement(searchBox).clear(); driver().findElement(searchBox).sendKeys(CommonData.getRandomShortString(10)); driver().findElement(By.id("largeSearchButton")).click(); ajaxWait(); } } catch (AssertionError e) { captureScreen("SearchTests.specialChars"); throw e; } catch (Exception e) { captureScreen("SearchTests.specialChars"); throw e; } }
From source file:at.tugraz.ist.catroweb.catroid.SearchTests.java
License:Open Source License
@Test(groups = { "functionality", "upload" }, description = "search test with page navigation") public void pageNavigation() throws Throwable { try {//from ww w .j av a 2 s.c o m String projectTitle = CommonData.getRandomShortString(10); openLocation(); ajaxWait(); int uploadCount = Config.PROJECT_PAGE_LOAD_MAX_PROJECTS * (Config.PROJECT_PAGE_SHOW_MAX_PAGES + 1); System.out.println("*** NOTICE *** Uploading " + uploadCount + " projects"); for (int i = 0; i < uploadCount; i++) { projectUploader.upload(CommonData.getUploadPayload(projectTitle + i, "pagenavigationtest", "", "", "", "", "", "")); if ((i % Config.PROJECT_PAGE_LOAD_MAX_PROJECTS) == 0) { driver().findElement(By.xpath("//*[@id='largeMenu']/div[2]/a")).click(); } } driver().findElement(By.xpath("//*[@id='largeMenu']/div[2]/a")).click(); ajaxWait(); assertFalse(isElementPresent(By.xpath("//a[@title=\"" + projectTitle + "0\"]"))); By searchBox = By.xpath("//*[@id='largeMenu']/div[4]/input"); driver().findElement(searchBox).clear(); driver().findElement(searchBox).sendKeys(projectTitle); driver().findElement(By.id("largeSearchButton")).click(); ajaxWait(); int pageNr = 0; for (; pageNr < Config.PROJECT_PAGE_SHOW_MAX_PAGES; pageNr++) { driver().findElement(By.id("moreResults")).click(); ajaxWait(); assertRegExp(".*p=" + (pageNr + 2) + ".*", driver().getCurrentUrl()); } pageNr++; assertTrue(isElementPresent(By.xpath("//a[@title=\"" + projectTitle + "0\"]"))); // test links to details page driver().findElement(By.xpath("//*[@id='searchResultContainer']/ul/li/a")).click(); ajaxWait(); assertRegExp(".*/details.*", driver().getCurrentUrl()); driver().navigate().back(); ajaxWait(); assertTrue(isTextPresent(CommonStrings.SEARCH_PROJECTS_PAGE_TITLE.toUpperCase())); assertRegExp(CommonStrings.WEBSITE_TITLE + " - " + CommonStrings.SEARCH_PROJECTS_PAGE_TITLE + " - " + projectTitle + " - " + (pageNr) + "", driver().getTitle()); assertTrue(isElementPresent(By.xpath("//a[@title=\"" + projectTitle + "0\"]"))); } catch (AssertionError e) { captureScreen("SearchTests.pageNavigation"); throw e; } catch (Exception e) { captureScreen("SearchTests.pageNavigation"); throw e; } }