Тестовите се експортирани како C#/NUnit/Web Driver. '''Register.cs''' {{{ using System; using System.Text; using System.Text.RegularExpressions; using System.Threading; using NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Support.UI; namespace SeleniumTests { [TestFixture] public class Register { private IWebDriver driver; private StringBuilder verificationErrors; private string baseURL; private bool acceptNextAlert = true; [SetUp] public void SetupTest() { driver = new FirefoxDriver(); baseURL = "http://localhost:1400/"; verificationErrors = new StringBuilder(); } [TearDown] public void TeardownTest() { try { driver.Quit(); } catch (Exception) { // Ignore errors if unable to close the browser } Assert.AreEqual("", verificationErrors.ToString()); } [Test] public void TheRegisterTest() { driver.Navigate().GoToUrl(baseURL + "/Default.aspx"); driver.FindElement(By.Id("ctl10_registerLink")).Click(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_UserName")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_UserName")).SendKeys("novstudent3"); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_Email")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_Email")).SendKeys("novstudent1@mail.com"); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_Password")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_Password")).SendKeys("novstudent"); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_ConfirmPassword")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_ConfirmPassword")).SendKeys("novstudent"); driver.FindElement(By.Name("ctl00$MainContent$RegisterUser$CreateUserStepContainer$ctl09")).Click(); driver.FindElement(By.Id("MainContent_txtImePrezime")).Clear(); driver.FindElement(By.Id("MainContent_txtImePrezime")).SendKeys("Student Nov"); driver.FindElement(By.Id("MainContent_txtMesto")).Clear(); driver.FindElement(By.Id("MainContent_txtMesto")).SendKeys("New York"); driver.FindElement(By.Id("MainContent_txtDatum")).Clear(); driver.FindElement(By.Id("MainContent_txtDatum")).SendKeys("01-08-1990"); driver.FindElement(By.Id("MainContent_txtObrazovanie")).Clear(); driver.FindElement(By.Id("MainContent_txtObrazovanie")).SendKeys("BS"); driver.FindElement(By.Id("MainContent_txtInstitucija")).Clear(); driver.FindElement(By.Id("MainContent_txtInstitucija")).SendKeys("Proba"); driver.FindElement(By.Id("MainContent_txtVrabotenVo")).Clear(); driver.FindElement(By.Id("MainContent_txtVrabotenVo")).SendKeys("Proba"); driver.FindElement(By.Id("MainContent_txtPozicija")).Clear(); driver.FindElement(By.Id("MainContent_txtPozicija")).SendKeys("Proba"); driver.FindElement(By.Id("MainContent_btnAdd")).Click(); driver.FindElement(By.Id("MainContent_Button2")).Click(); driver.FindElement(By.Id("MainContent_Button1")).Click(); driver.FindElement(By.Id("MainContent_txtActivity")).Clear(); driver.FindElement(By.Id("MainContent_txtActivity")).SendKeys("rrr"); driver.FindElement(By.Id("MainContent_btnShow")).Click(); driver.FindElement(By.Id("MainContent_txtRoleOnExisting")).Clear(); driver.FindElement(By.Id("MainContent_txtRoleOnExisting")).SendKeys("uuu"); driver.FindElement(By.Id("MainContent_gvMe_CheckBox1_0")).Click(); driver.FindElement(By.Id("MainContent_btnAddMe")).Click(); driver.FindElement(By.LinkText("Мојата Биографија")).Click(); } private bool IsElementPresent(By by) { try { driver.FindElement(by); return true; } catch (NoSuchElementException) { return false; } } private bool IsAlertPresent() { try { driver.SwitchTo().Alert(); return true; } catch (NoAlertPresentException) { return false; } } private string CloseAlertAndGetItsText() { try { IAlert alert = driver.SwitchTo().Alert(); string alertText = alert.Text; if (acceptNextAlert) { alert.Accept(); } else { alert.Dismiss(); } return alertText; } finally { acceptNextAlert = true; } } } } }}} '''Loginfieldvalidation.cs''' {{{ using System; using System.Text; using System.Text.RegularExpressions; using System.Threading; using NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Support.UI; namespace SeleniumTests { [TestFixture] public class LoginFieldValidation { private IWebDriver driver; private StringBuilder verificationErrors; private string baseURL; private bool acceptNextAlert = true; [SetUp] public void SetupTest() { driver = new FirefoxDriver(); baseURL = "http://localhost:1400/"; verificationErrors = new StringBuilder(); } [TearDown] public void TeardownTest() { try { driver.Quit(); } catch (Exception) { // Ignore errors if unable to close the browser } Assert.AreEqual("", verificationErrors.ToString()); } [Test] public void TheLoginFieldValidationTest() { driver.Navigate().GoToUrl(baseURL + "/"); driver.FindElement(By.Id("ctl10_loginLink")).Click(); driver.FindElement(By.Id("MainContent_ctl00_btnLogin")).Click(); driver.FindElement(By.Id("MainContent_ctl00_UserName")).Clear(); driver.FindElement(By.Id("MainContent_ctl00_UserName")).SendKeys("student123"); driver.FindElement(By.Id("MainContent_ctl00_Password")).Clear(); driver.FindElement(By.Id("MainContent_ctl00_Password")).SendKeys("aaa"); driver.FindElement(By.Id("MainContent_ctl00_btnLogin")).Click(); driver.FindElement(By.Id("MainContent_ctl00_UserName")).Clear(); driver.FindElement(By.Id("MainContent_ctl00_UserName")).SendKeys("student12"); driver.FindElement(By.Id("MainContent_ctl00_Password")).Clear(); driver.FindElement(By.Id("MainContent_ctl00_Password")).SendKeys("student1233"); driver.FindElement(By.Id("MainContent_ctl00_btnLogin")).Click(); driver.FindElement(By.Id("MainContent_ctl00_UserName")).Clear(); driver.FindElement(By.Id("MainContent_ctl00_UserName")).SendKeys("student123"); driver.FindElement(By.Id("MainContent_ctl00_Password")).Clear(); driver.FindElement(By.Id("MainContent_ctl00_Password")).SendKeys("student123"); driver.FindElement(By.Id("MainContent_ctl00_btnLogin")).Click(); } private bool IsElementPresent(By by) { try { driver.FindElement(by); return true; } catch (NoSuchElementException) { return false; } } private bool IsAlertPresent() { try { driver.SwitchTo().Alert(); return true; } catch (NoAlertPresentException) { return false; } } private string CloseAlertAndGetItsText() { try { IAlert alert = driver.SwitchTo().Alert(); string alertText = alert.Text; if (acceptNextAlert) { alert.Accept(); } else { alert.Dismiss(); } return alertText; } finally { acceptNextAlert = true; } } } } }}} '''Registerfieldvalidation.cs''' {{{ using System; using System.Text; using System.Text.RegularExpressions; using System.Threading; using NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Support.UI; namespace SeleniumTests { [TestFixture] public class RegisterFieldValidation { private IWebDriver driver; private StringBuilder verificationErrors; private string baseURL; private bool acceptNextAlert = true; [SetUp] public void SetupTest() { driver = new FirefoxDriver(); baseURL = "http://localhost:1400/"; verificationErrors = new StringBuilder(); } [TearDown] public void TeardownTest() { try { driver.Quit(); } catch (Exception) { // Ignore errors if unable to close the browser } Assert.AreEqual("", verificationErrors.ToString()); } [Test] public void TheRegisterFieldValidationTest() { driver.Navigate().GoToUrl(baseURL + "/"); driver.FindElement(By.Id("ctl10_registerLink")).Click(); driver.FindElement(By.Name("ctl00$MainContent$RegisterUser$CreateUserStepContainer$ctl09")).Click(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_UserName")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_UserName")).SendKeys("abc"); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_Email")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_Email")).SendKeys("abc@mail.com"); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_Password")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_Password")).SendKeys("abcabc1"); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_ConfirmPassword")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_ConfirmPassword")).SendKeys("abcabc1"); driver.FindElement(By.Name("ctl00$MainContent$RegisterUser$CreateUserStepContainer$ctl09")).Click(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_UserName")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_UserName")).SendKeys("abcde"); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_Password")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_Password")).SendKeys("abcdefg1"); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_ConfirmPassword")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_ConfirmPassword")).SendKeys("abvv"); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_ConfirmPassword")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_ConfirmPassword")).SendKeys("abcdefg1"); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_UserName")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_UserName")).SendKeys("abcdefg"); driver.FindElement(By.Name("ctl00$MainContent$RegisterUser$CreateUserStepContainer$ctl09")).Click(); driver.FindElement(By.LinkText("Мојата Биографија")).Click(); } private bool IsElementPresent(By by) { try { driver.FindElement(by); return true; } catch (NoSuchElementException) { return false; } } private bool IsAlertPresent() { try { driver.SwitchTo().Alert(); return true; } catch (NoAlertPresentException) { return false; } } private string CloseAlertAndGetItsText() { try { IAlert alert = driver.SwitchTo().Alert(); string alertText = alert.Text; if (acceptNextAlert) { alert.Accept(); } else { alert.Dismiss(); } return alertText; } finally { acceptNextAlert = true; } } } } }}} '''Search.cs''' {{{ using System; using System.Text; using System.Text.RegularExpressions; using System.Threading; using NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Support.UI; namespace SeleniumTests { [TestFixture] public class Search { private IWebDriver driver; private StringBuilder verificationErrors; private string baseURL; private bool acceptNextAlert = true; [SetUp] public void SetupTest() { driver = new FirefoxDriver(); baseURL = "http://localhost:1400/"; verificationErrors = new StringBuilder(); } [TearDown] public void TeardownTest() { try { driver.Quit(); } catch (Exception) { // Ignore errors if unable to close the browser } Assert.AreEqual("", verificationErrors.ToString()); } [Test] public void TheSearchTest() { driver.Navigate().GoToUrl(baseURL + "/Default.aspx"); driver.FindElement(By.LinkText("Контакт")).Click(); driver.FindElement(By.Id("txtSearch")).Clear(); driver.FindElement(By.Id("txtSearch")).SendKeys("IS"); driver.FindElement(By.Id("btnSearch")).Click(); driver.FindElement(By.LinkText("Почетна")).Click(); driver.FindElement(By.Id("txtSearch")).Clear(); driver.FindElement(By.Id("txtSearch")).SendKeys("IS"); driver.FindElement(By.Id("btnSearch")).Click(); } private bool IsElementPresent(By by) { try { driver.FindElement(by); return true; } catch (NoSuchElementException) { return false; } } private bool IsAlertPresent() { try { driver.SwitchTo().Alert(); return true; } catch (NoAlertPresentException) { return false; } } private string CloseAlertAndGetItsText() { try { IAlert alert = driver.SwitchTo().Alert(); string alertText = alert.Text; if (acceptNextAlert) { alert.Accept(); } else { alert.Dismiss(); } return alertText; } finally { acceptNextAlert = true; } } } } }}} '''Changepassword.cs''' {{{ using System; using System.Text; using System.Text.RegularExpressions; using System.Threading; using NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Support.UI; namespace SeleniumTests { [TestFixture] public class ChangePassword { private IWebDriver driver; private StringBuilder verificationErrors; private string baseURL; private bool acceptNextAlert = true; [SetUp] public void SetupTest() { driver = new FirefoxDriver(); baseURL = "http://localhost:1400/"; verificationErrors = new StringBuilder(); } [TearDown] public void TeardownTest() { try { driver.Quit(); } catch (Exception) { // Ignore errors if unable to close the browser } Assert.AreEqual("", verificationErrors.ToString()); } [Test] public void TheChangePasswordTest() { driver.Navigate().GoToUrl(baseURL + "/Default.aspx"); driver.FindElement(By.Id("ctl10_loginLink")).Click(); driver.FindElement(By.Id("MainContent_ctl00_UserName")).Clear(); driver.FindElement(By.Id("MainContent_ctl00_UserName")).SendKeys("student123"); driver.FindElement(By.Id("MainContent_ctl00_Password")).Clear(); driver.FindElement(By.Id("MainContent_ctl00_Password")).SendKeys("student123"); driver.FindElement(By.Id("MainContent_ctl00_btnLogin")).Click(); driver.FindElement(By.Id("ctl10_hpLink")).Click(); driver.FindElement(By.Id("MainContent_ctl07_ChangePasswordContainerID_CurrentPassword")).Clear(); driver.FindElement(By.Id("MainContent_ctl07_ChangePasswordContainerID_CurrentPassword")).SendKeys("student123"); driver.FindElement(By.Id("MainContent_ctl07_ChangePasswordContainerID_NewPassword")).Clear(); driver.FindElement(By.Id("MainContent_ctl07_ChangePasswordContainerID_NewPassword")).SendKeys("student1234"); driver.FindElement(By.Id("MainContent_ctl07_ChangePasswordContainerID_ConfirmNewPassword")).Clear(); driver.FindElement(By.Id("MainContent_ctl07_ChangePasswordContainerID_ConfirmNewPassword")).SendKeys("student1234"); driver.FindElement(By.Name("ctl00$MainContent$ctl07$ChangePasswordContainerID$ctl04")).Click(); driver.FindElement(By.LinkText("Одјави се")).Click(); driver.FindElement(By.Id("ctl10_loginLink")).Click(); driver.FindElement(By.Id("MainContent_ctl00_UserName")).Clear(); driver.FindElement(By.Id("MainContent_ctl00_UserName")).SendKeys("student123"); driver.FindElement(By.Id("MainContent_ctl00_Password")).Clear(); driver.FindElement(By.Id("MainContent_ctl00_Password")).SendKeys("student1234"); driver.FindElement(By.Id("MainContent_ctl00_btnLogin")).Click(); driver.FindElement(By.LinkText("Одјави се")).Click(); } private bool IsElementPresent(By by) { try { driver.FindElement(by); return true; } catch (NoSuchElementException) { return false; } } private bool IsAlertPresent() { try { driver.SwitchTo().Alert(); return true; } catch (NoAlertPresentException) { return false; } } private string CloseAlertAndGetItsText() { try { IAlert alert = driver.SwitchTo().Alert(); string alertText = alert.Text; if (acceptNextAlert) { alert.Accept(); } else { alert.Dismiss(); } return alertText; } finally { acceptNextAlert = true; } } } } }}} '''Addinfo.cs''' {{{ using System; using System.Text; using System.Text.RegularExpressions; using System.Threading; using NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Support.UI; namespace SeleniumTests { [TestFixture] public class AddInfoLater { private IWebDriver driver; private StringBuilder verificationErrors; private string baseURL; private bool acceptNextAlert = true; [SetUp] public void SetupTest() { driver = new FirefoxDriver(); baseURL = "http://localhost:1400/"; verificationErrors = new StringBuilder(); } [TearDown] public void TeardownTest() { try { driver.Quit(); } catch (Exception) { // Ignore errors if unable to close the browser } Assert.AreEqual("", verificationErrors.ToString()); } [Test] public void TheAddInfoLaterTest() { driver.Navigate().GoToUrl(baseURL + "/"); driver.FindElement(By.Id("ctl10_registerLink")).Click(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_UserName")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_UserName")).SendKeys("mojasmetka1"); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_Email")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_Email")).SendKeys("adresa@mail.com"); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_Password")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_Password")).SendKeys("mojasmetka1"); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_ConfirmPassword")).Clear(); driver.FindElement(By.Id("MainContent_RegisterUser_CreateUserStepContainer_ConfirmPassword")).SendKeys("mojasmetka1"); driver.FindElement(By.Name("ctl00$MainContent$RegisterUser$CreateUserStepContainer$ctl09")).Click(); driver.FindElement(By.Id("MainContent_Button2")).Click(); driver.FindElement(By.LinkText("Мојата Биографија")).Click(); driver.FindElement(By.CssSelector("span.username")).Click(); driver.FindElement(By.Id("MainContent_txtImePrezime")).Clear(); driver.FindElement(By.Id("MainContent_txtImePrezime")).SendKeys("moja"); driver.FindElement(By.Id("MainContent_rblPol_1")).Click(); driver.FindElement(By.Id("MainContent_txtMesto")).Clear(); driver.FindElement(By.Id("MainContent_txtMesto")).SendKeys("ww"); driver.FindElement(By.Id("MainContent_txtDatum")).Clear(); driver.FindElement(By.Id("MainContent_txtDatum")).SendKeys("16.06.1989"); driver.FindElement(By.Id("MainContent_txtObrazovanie")).Clear(); driver.FindElement(By.Id("MainContent_txtObrazovanie")).SendKeys("ww"); driver.FindElement(By.Id("MainContent_txtInstitucija")).Clear(); driver.FindElement(By.Id("MainContent_txtInstitucija")).SendKeys("ww"); driver.FindElement(By.Id("MainContent_txtVrabotenVo")).Clear(); driver.FindElement(By.Id("MainContent_txtVrabotenVo")).SendKeys("ww"); driver.FindElement(By.Id("MainContent_txtPozicija")).Clear(); driver.FindElement(By.Id("MainContent_txtPozicija")).SendKeys("ww"); driver.FindElement(By.Id("MainContent_btnAdd")).Click(); driver.FindElement(By.LinkText("Мојата Биографија")).Click(); } private bool IsElementPresent(By by) { try { driver.FindElement(by); return true; } catch (NoSuchElementException) { return false; } } private bool IsAlertPresent() { try { driver.SwitchTo().Alert(); return true; } catch (NoAlertPresentException) { return false; } } private string CloseAlertAndGetItsText() { try { IAlert alert = driver.SwitchTo().Alert(); string alertText = alert.Text; if (acceptNextAlert) { alert.Accept(); } else { alert.Dismiss(); } return alertText; } finally { acceptNextAlert = true; } } } } }}} '''Addnewactivity.cs''' {{{ using System; using System.Text; using System.Text.RegularExpressions; using System.Threading; using NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Support.UI; namespace SeleniumTests { [TestFixture] public class AddNewActivity { private IWebDriver driver; private StringBuilder verificationErrors; private string baseURL; private bool acceptNextAlert = true; [SetUp] public void SetupTest() { driver = new FirefoxDriver(); baseURL = "http://localhost:1400/"; verificationErrors = new StringBuilder(); } [TearDown] public void TeardownTest() { try { driver.Quit(); } catch (Exception) { // Ignore errors if unable to close the browser } Assert.AreEqual("", verificationErrors.ToString()); } [Test] public void TheAddNewActivityTest() { driver.Navigate().GoToUrl(baseURL + "/Default.aspx"); driver.FindElement(By.Id("ctl10_loginLink")).Click(); driver.FindElement(By.Id("MainContent_ctl00_UserName")).Clear(); driver.FindElement(By.Id("MainContent_ctl00_UserName")).SendKeys("student123"); driver.FindElement(By.Id("MainContent_ctl00_Password")).Clear(); driver.FindElement(By.Id("MainContent_ctl00_Password")).SendKeys("student1234"); driver.FindElement(By.Id("MainContent_ctl00_RememberMe")).Click(); driver.FindElement(By.Id("MainContent_ctl00_btnLogin")).Click(); driver.FindElement(By.Id("MainContent_Button1")).Click(); driver.FindElement(By.Id("MainContent_txtName")).Clear(); driver.FindElement(By.Id("MainContent_txtName")).SendKeys("nestonovo"); driver.FindElement(By.Id("MainContent_txtCategory")).Clear(); driver.FindElement(By.Id("MainContent_txtCategory")).SendKeys("/"); driver.FindElement(By.Id("MainContent_txtPlace")).Clear(); driver.FindElement(By.Id("MainContent_txtPlace")).SendKeys("Proba"); driver.FindElement(By.Id("MainContent_txtDate")).Clear(); driver.FindElement(By.Id("MainContent_txtDate")).SendKeys("11.11.2013"); driver.FindElement(By.Id("MainContent_txtRole")).Clear(); driver.FindElement(By.Id("MainContent_txtRole")).SendKeys("/"); driver.FindElement(By.Id("MainContent_btnInsert")).Click(); driver.FindElement(By.LinkText("Мојата Биографија")).Click(); driver.FindElement(By.LinkText("Одјави се")).Click(); } private bool IsElementPresent(By by) { try { driver.FindElement(by); return true; } catch (NoSuchElementException) { return false; } } private bool IsAlertPresent() { try { driver.SwitchTo().Alert(); return true; } catch (NoAlertPresentException) { return false; } } private string CloseAlertAndGetItsText() { try { IAlert alert = driver.SwitchTo().Alert(); string alertText = alert.Text; if (acceptNextAlert) { alert.Accept(); } else { alert.Dismiss(); } return alertText; } finally { acceptNextAlert = true; } } } } }}} '''Addusertoexistingactivity.cs''' {{{ using System; using System.Text; using System.Text.RegularExpressions; using System.Threading; using NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Support.UI; namespace SeleniumTests { [TestFixture] public class AddUserToExistingActivity { private IWebDriver driver; private StringBuilder verificationErrors; private string baseURL; private bool acceptNextAlert = true; [SetUp] public void SetupTest() { driver = new FirefoxDriver(); baseURL = "http://localhost:1400/"; verificationErrors = new StringBuilder(); } [TearDown] public void TeardownTest() { try { driver.Quit(); } catch (Exception) { // Ignore errors if unable to close the browser } Assert.AreEqual("", verificationErrors.ToString()); } [Test] public void TheAddUserToExistingActivityTest() { driver.Navigate().GoToUrl(baseURL + "/"); driver.FindElement(By.Id("ctl10_loginLink")).Click(); driver.FindElement(By.Id("MainContent_ctl00_UserName")).Clear(); driver.FindElement(By.Id("MainContent_ctl00_UserName")).SendKeys("student123"); driver.FindElement(By.Id("MainContent_ctl00_Password")).Clear(); driver.FindElement(By.Id("MainContent_ctl00_Password")).SendKeys("student123"); driver.FindElement(By.Id("MainContent_ctl00_RememberMe")).Click(); driver.FindElement(By.Id("MainContent_ctl00_btnLogin")).Click(); driver.FindElement(By.Id("MainContent_Button1")).Click(); driver.FindElement(By.Id("MainContent_txtActivity")).Clear(); driver.FindElement(By.Id("MainContent_txtActivity")).SendKeys("nnnn"); driver.FindElement(By.Id("MainContent_btnShow")).Click(); driver.FindElement(By.Id("MainContent_txtRoleOnExisting")).Clear(); driver.FindElement(By.Id("MainContent_txtRoleOnExisting")).SendKeys("mmm"); driver.FindElement(By.Id("MainContent_gvMe_CheckBox1_0")).Click(); driver.FindElement(By.Id("MainContent_btnAddMe")).Click(); driver.FindElement(By.LinkText("Мојата Биографија")).Click(); driver.FindElement(By.LinkText("2")).Click(); } private bool IsElementPresent(By by) { try { driver.FindElement(by); return true; } catch (NoSuchElementException) { return false; } } private bool IsAlertPresent() { try { driver.SwitchTo().Alert(); return true; } catch (NoAlertPresentException) { return false; } } private string CloseAlertAndGetItsText() { try { IAlert alert = driver.SwitchTo().Alert(); string alertText = alert.Text; if (acceptNextAlert) { alert.Accept(); } else { alert.Dismiss(); } return alertText; } finally { acceptNextAlert = true; } } } } }}}