public void SetupClass() { base.StartServer(); selenium = new DefaultSelenium("localhost", 4444, "*chrome", ConfigurationManager.AppSettings["baseUrl"]); selenium.Start(); verificationErrors = new StringBuilder(); selenium.DeleteAllVisibleCookies(); selenium.Open("/dna/mbfood/"); // To Do // too general, could crash test if a topic happened to have the wrong name Assert.IsFalse(selenium.IsTextPresent("error")); Assert.IsFalse(selenium.IsTextPresent("There has been a problem")); selenium.Click("link=Sign in"); selenium.Click("bbcid_username"); selenium.Type("bbcid_username", "mpgsuper"); selenium.Type("bbcid_password", "ratbags"); selenium.Click("signin"); selenium.WaitForPageToLoad("30000"); // going this way so as to be certain to get the right site options without thinking about it selenium.Click("link=Site Options"); selenium.WaitForPageToLoad("30000"); // check a) where we are b) BBC site requirements for page titles https://confluence.dev.bbc.co.uk/display/DNA/Meta+Data - note that this title breaks those guidelines Assert.AreEqual("BBC - Food - DNA Administration - Site Options - Food", selenium.GetTitle()); Assert.IsTrue(selenium.IsElementPresent("//input[@name='sov_49_General_CustomBarlesquePath']"); stateOfOption = selenium.GetValue("//input[@name='so_49_General_CustomBarlesquePath' and @type='radio' and @checked='']/@value"); valueOfOption = selenium.GetValue("//input[@name='so_49_General_CustomBarlesquePath' and @type='text']"); }
public void CreateOrder() { RegisterAndLogin(); selenium.Open("/customerView_Home.aspx"); selenium.WaitForPageToLoad("5000"); selenium.Click("ctl00_navigation_menu_NavigationControl_NavTreeViewt0"); selenium.WaitForPageToLoad("5000"); selenium.Type("ctl00_body_content_txtJobName", "Salsa Impulse"); selenium.Type("ctl00_body_content_txtFinalSizeX", "5"); selenium.Type("ctl00_body_content_txtFinalSizeY", "5"); selenium.Type("ctl00_body_content_txtQty", "1000"); selenium.Select("ctl00_body_content_lstWeight", "label=Light"); selenium.Check("ctl00_body_content_chkTwoSide"); selenium.Type("ctl00_body_content_FileUpload", "C:\\Documents and Settings\\Javier\\Desktop\\Salsa Impulse\\SalsaImpulseBusinessCard.jpg"); selenium.Click("ctl00_body_content_btnFileUpload"); selenium.WaitForPageToLoad("5000"); Assert.IsTrue(selenium.IsTextPresent("Uploaded File:")); Assert.IsTrue(selenium.IsTextPresent("SalsaImpulseBusinessCard.jpg")); selenium.Click("ctl00_body_content_createPay"); selenium.WaitForPageToLoad("5000"); int count = orderRepo.Orders.Where(o => o.job_name == "Salsa Impulse").Count(); Assert.AreEqual(1, count); Order order = orderRepo.Orders.Where(o => o.job_name == "Salsa Impulse").Single(); Assert.AreEqual("Salsa Impulse", order.job_name.Trim()); Assert.AreEqual(5.0, order.width); Assert.AreEqual(5.0, order.height); Assert.AreEqual(1000, order.quantity); Assert.IsTrue(order.two_sided); }
public void Test_CreateEditDeleteRole() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Roles"); selenium.WaitForPageToLoad("30000"); selenium.Click("//input[@value='Create Role']"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_Name", "Test Role #1"); selenium.Click("ctl00_Body_ctl00_SaveButton"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Test Role #1"), "Text 'Test Role #1' not found when it should be."); selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_EditButton"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_Name", "Test Role #1"); selenium.Click("//input[@value='Update']"); selenium.WaitForPageToLoad("30000"); selenium.ChooseOkOnNextConfirmation(); selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_DeleteButton"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.GetConfirmation() != null && selenium.GetConfirmation().IndexOf("Are you sure you want to delete this role?") > -1, "Confirm box didn't appear when expected."); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("deleted successfully"), "Text 'deleted successfully' not found when it should be."); Assert.IsFalse(selenium.IsTextPresent("Test Role"), "Text 'Test Role' found when it shouldn't be."); }
public void GetCurrentlyLoggedInUserWhenLogged() { selenium.Open("/"); selenium.Type("id=loginPassword", "lex"); selenium.Type("id=loginUsername", "lex"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsElementPresent("//a[contains(@href, '/Account/Index')]")); Assert.IsTrue(selenium.IsTextPresent("Logged in as lex")); }
public void Test_Initialize() { selenium.SetTimeout("2000000"); selenium.Open("Admin/tests/testreset.aspx?Log=true&Config=true"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Open("Admin/InitializeCache.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); }
public void Test_Data() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/Data.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("User-UserRole"), "Text 'User-UserRole' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("User"), "Text 'User' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("UserRole"), "Text 'UserRole' not found when it should be."); selenium.Click("link=User"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("SoftwareMonkeys.SiteStarter.Entities.User"), "Text 'SoftwareMonkeys.SiteStarter.Entities.User' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("*****@*****.**"), "Text '*****@*****.**' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Username: admin"), "Text 'Username: admin' not found when it should be."); selenium.Click("link=Sign Out"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/Data.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); }
public void Test_Setup() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx?Log=true&Config=true"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("You are signed in as"), "Text 'You are signed in as' not found when it should be."); Thread.Sleep(5000); }
public void Test_AutoBackup() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx?Log=true&Config=true"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Open(""); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Thread.Sleep(10000); selenium.Open("Admin/tests/LogContains.aspx?Query=%3CData%3E${BackupComplete}%3C/Data%3E"); Assert.IsTrue(selenium.IsTextPresent("LogContains=True"), "Text 'LogContains=True' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("FoundTotal=1"), "Text 'FoundTotal=1' not found when it should be."); }
public void Test_Roles() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("MockCreate-User.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Roles"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("Manage Roles"), "Text 'Manage Roles' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Edit"), "Text 'Edit' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Delete"), "Text 'Delete' not found when it should be."); selenium.Click("//input[@value='Create Role']"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_Name", "A Test Role"); selenium.AddSelection("ctl00_Body_ctl00_Users", "label=FirstName1 LastName1"); selenium.Click("//input[@value='Save']"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("saved successfully"), "Text 'saved successfully' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Manage Roles"), "Text 'Manage Roles' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Test Role"), "Text 'Test Role' not found when it should be."); selenium.Click("link=Edit"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("System Administrator", selenium.GetSelectedLabel("ctl00_Body_ctl00_Users")); selenium.AddSelection("ctl00_Body_ctl00_Users", "FirstName1 LastName1"); selenium.Click("//input[@value='Update']"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("updated successfully"), "Text 'updated successfully' not found when it should be."); selenium.Click("link=Edit"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("FirstName1 LastName1,System Administrator", String.Join(",", selenium.GetSelectedLabels("ctl00_Body_ctl00_Users"))); }
public void Test_Import() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx?Log=true&Config=true"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Open("Admin/Tests/PrepareTestImport.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Open("Admin/Import.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("Import Complete"), "Text 'Import Complete' not found when it should be."); }
///<summary> /// To exclude a customer from a company /// Author: Yogesh /// Ex:Customer_CompanyExclusion(myBrowser) /// <returns>None</returns> /// Created Date: 22-Dec-2011 /// Modified Date: 22-Dec-2011 /// Modification Comments: public void CustomerCompanyExclusion(ISelenium myBrowser) { _isUpdateCustomersResourceFile = false; string cmpnyExclu = "ATEcommATCmpnyExcl"; string guidBnCust = Guid.NewGuid().ToString().Substring(0, 3); cmpnyExclu = cmpnyExclu + guidBnCust; string strUser = _common.CreateCustomer(myBrowser, cmpnyExclu, StrPasswrd); if (strUser != "Fail") { myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.CompanyExcludedCustomerBtn); _frameworkCommon.WaitUntilAllElementsLoad(myBrowser); System.Threading.Thread.Sleep(10000); Assert.IsTrue(myBrowser.IsTextPresent("New Company Exclusion Added"), "Company Exclusion is unsuccessfull"); _isUpdateCustomersResourceFile = _common.UpdateCustomerResouceFile("CompanyExcludedCustomer", strUser, StrPasswrd); if (_isUpdateCustomersResourceFile == false) { Framework.BaseTest.Fail("Customers Resource File updation failed."); } } else { Framework.BaseTest.Fail("User creation Failed"); } }
public void Test_Settings() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Settings"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Click("link=Sign Out"); selenium.WaitForPageToLoad("30000"); selenium.Open("Index-Settings.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); }
///<summary> /// To add a customer belonging to a banned country /// Author: Yogesh /// Ex:Customer_CompanyExclusion(myBrowser) /// <returns>None</returns> /// Created Date: 22-Dec-2011 /// Modified Date: public void CustomerFrmBannedCntry(ISelenium myBrowser) { _isUpdateCustomersResourceFile = false; string banCustomer = "ATEcommATBnCust"; string guidBnCust = Guid.NewGuid().ToString().Substring(0, 4); banCustomer = banCustomer + guidBnCust; string strUser = _common.CreateCustomer(myBrowser, banCustomer, StrPasswrd); if (strUser != "Fail") { //strUser = common.SelectMainFrame(myBrowser); _common.SelectMainFrame(myBrowser); Assert.IsTrue(myBrowser.IsElementPresent(AdminSuite.CustomerCreation.CustomersPage.UpdateRegistrationButton), "Update Registration button is not found"); myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateRegistrationButton); const string strBannedCountryName = "Italy"; myBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.CntryTxtBx, strBannedCountryName); myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateCustomerButton); _frameworkCommon.WaitUntilAllElementsLoad(myBrowser); Assert.IsTrue(myBrowser.IsTextPresent(strBannedCountryName), "Change of country to a Banned Country is not successfull"); _isUpdateCustomersResourceFile = _common.UpdateCustomerResouceFile("BannedCountryCustomer", strUser, StrPasswrd); if (_isUpdateCustomersResourceFile == false) { Framework.BaseTest.Fail("Customers Resource File updation failed."); } } else { Framework.BaseTest.Fail("User creation Failed"); } }
public void PolygonCount( [Values( "duffle_bag.zip" )] string mFileToUpload ) { path = Properties.Settings.Default.ContentPath; if (mFileToUpload == "") { return; } selenium.Open("/Default.aspx"); if (selenium.IsTextPresent("Sign In")) { selenium.Click("ctl00_LoginStatus1"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_UserName", Properties.Settings.Default._3DRUserName); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_Password", Properties.Settings.Default._3DRPassword); selenium.Click("ctl00_ContentPlaceHolder1_Login1_Login1_LoginButton"); } selenium.WaitForPageToLoad("30000"); selenium.Open("/Users/Upload.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_TitleTextBox", "Screenshot Test" + System.DateTime.Now.ToString()); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_ContentFileUpload", path + mFileToUpload); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_Step1NextButton"); selenium.WaitForPageToLoad("300000"); selenium.WaitForCondition("window.GetLoadingComplete != undefined", "20000"); int count = 0; while ((selenium.GetEval("window.GetLoadingComplete() == true") != "true" && count < 30)) { count++; System.Threading.Thread.Sleep(1000); } NUnit.Framework.Assert.AreEqual(selenium.GetEval("window.GetLoadingComplete() == true"), "true"); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_ValidationViewSubmitButton"); selenium.WaitForPageToLoad("30000"); NUnit.Framework.Assert.IsFalse(selenium.IsTextPresent("Number of Polygons: 0")); }
public void Upload(string mFileToUpload) { path = Properties.Settings.Default.ContentPath; if (mFileToUpload == "") { return; } selenium.Open("/Default.aspx"); if (selenium.IsTextPresent("Sign In")) { selenium.Click("ctl00_LoginStatus1"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_UserName", Properties.Settings.Default._3DRUserName); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_Password", Properties.Settings.Default._3DRPassword); selenium.Click("ctl00_ContentPlaceHolder1_Login1_Login1_LoginButton"); } selenium.WaitForPageToLoad("30000"); selenium.Open("/Users/Upload.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_TitleTextBox", "Automatic Test of " + mFileToUpload + " " + System.DateTime.Now.ToString()); SetUploadFile(path + mFileToUpload); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_Step1NextButton"); selenium.WaitForPageToLoad("1200000"); selenium.WaitForCondition("window.GetLoadingComplete != undefined", "300000"); int count = 0; while ((selenium.GetEval("window.GetLoadingComplete() == true") != "true" && count < 300)) { count++; System.Threading.Thread.Sleep(1000); } if (selenium.GetEval("window.GetLoadingComplete() == true") == "true") { selenium.GetEval("window.TakeScreenShot();"); System.Threading.Thread.Sleep(3000); //count = 0; //string Thumbstring = selenium.GetEval("document.getElementById('ctl00_ContentPlaceHolder1_Upload1_ThumbnailImage')"); //while (Thumbstring.IndexOf("ScreenShot") == -1 && count < 10) //{ // count++; // System.Threading.Thread.Sleep(1000); // Thumbstring = selenium.GetEval("document.getElementById('ctl00_ContentPlaceHolder1_Upload1_ThumbnailImage')"); //} } // ctl00_ContentPlaceHolder1_Upload1_ThumbnailImage selenium.Click("ctl00_ContentPlaceHolder1_Upload1_ValidationViewSubmitButton"); selenium.WaitForPageToLoad("1200000"); }
public void VerifyText(String expected, String id) { //Console.Out.WriteLine(expected); Assert.IsTrue(selenium.IsTextPresent(expected)); String actual = selenium.GetText(id); Assert.AreEqual(expected, actual, id + " didn't match"); }
public void WithValidData() { selenium.Open("/"); selenium.Type("id=loginPassword", "lex"); selenium.Type("id=loginUsername", "lex"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait); selenium.Click("//a[contains(@href, '/Account/Index')]"); selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait); selenium.Click("//a[contains(@href, '/Account/Edit')]"); selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait); selenium.Type("id=Name", "nestor"); selenium.Type("id=Email", "*****@*****.**"); selenium.Click("//input[@value='Save']"); selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait); Assert.IsTrue(selenium.IsTextPresent("nestor")); }
public void Test_Errors() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx?Log=true"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("NonExistentPage.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("Oops"), "Text 'Oops' not found when it should be."); selenium.Open("Admin/Errors.aspx"); Assert.IsTrue(selenium.IsTextPresent("Errors"), "Text 'Errors' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("NonExistentPage.aspx"), "Text 'NonExistentPage.aspx' not found when it should be."); selenium.Open("User-SignOut.aspx"); selenium.Open("Admin/Errors.aspx"); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); }
public void LoginWithInvalidConnected() { selenium.Open("/"); selenium.Type("id=loginIdentifier", "aaa"); selenium.Click("//div[@id='logindisplay']/form[1]/input[2]"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsElementPresent("//a[contains(@href, '/Account/Index')]")); Assert.IsTrue(selenium.IsTextPresent("Login failed using the provided OpenID identifier")); }
///<summary> /// This method Clicks on the NRF links and validates the URl opened in the new browser /// <example>ValidatePopupsofNFR(MyBrowser, "xPath", "Ladbrokes LBR", "https://www.gibraltar.gov.gi/remotegambling"); public void ValidatePopupsofNFR(ISelenium browser, string xPath, string newWindowTitle, string expURL) { try { browser.Click(xPath); HGframeworkCommonObj.PageSync(browser); HGframeworkCommonObj.WaitUntilElementPresent(browser, LoginLogoutControls.alertContainer, "5000"); Thread.Sleep(1000); Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.alertContainer), "Alert container was not displayed on tapping the '" + xPath + "' link"); Assert.IsTrue(browser.IsTextPresent("You are about to navigate away from the site and any selections you have in the betslip may be lost"), "Warning message[1] is not displayed in the Alert container"); Assert.IsTrue(browser.IsTextPresent("Do you want to navigate away?"), "Warning message[2] is not displayed in the Alert container"); browser.Click(LoginLogoutControls.CloseButtonInAlertContainer); HGframeworkCommonObj.PageSync(browser); Assert.IsFalse(browser.IsVisible(LoginLogoutControls.alertContainer), "Alert container failed to close on tapping the Cancel button"); browser.Click(xPath); HGframeworkCommonObj.WaitUntilElementPresent(browser, LoginLogoutControls.alertContainer, "5000"); Thread.Sleep(1000); Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.alertContainer), "Alert container was not displayed on tapping the '" + xPath + "' link"); browser.Click(LoginLogoutControls.ContinueButtonInAlertContainer); HGframeworkCommonObj.PageSync(browser); Thread.Sleep(2000); HGFcommonObj.SwitchWindow(browser, newWindowTitle); string actUrl = browser.GetLocation(); // url = driver.Url; browser.Close(); browser.SelectWindow("null"); Thread.Sleep(1000); if (actUrl.ToLower().Trim() != expURL.ToLower().Trim()) { Console.WriteLine("Mismatch in URL's. Actual '" + actUrl + "', Expected '" + expURL + "'."); } } catch (Exception ex) { Console.WriteLine("Function 'ValidatePopupsofNFR' - Failed"); Console.WriteLine(ex.Message); Fail(ex.Message); } }
public void GoogleSearch() { selenium.Open("http://www.google.com/webhp"); Assert.AreEqual("Google", selenium.GetTitle()); selenium.Type("q", "Selenium OpenQA"); Assert.AreEqual("Selenium OpenQA", selenium.GetValue("q")); selenium.Click("btnG"); selenium.WaitForPageToLoad("5000"); Assert.IsTrue(selenium.IsTextPresent("www.openqa.org")); Assert.AreEqual("Selenium OpenQA - Google Search", selenium.GetTitle()); }
// Wait for text present. Time out is 30s. public static void WaitforTextPresent(string sText,ISelenium selenium) { for (int i = 0; i < 100; i++) { if (selenium.IsTextPresent(sText)) { break; } Thread.Sleep(50); } }
public void Test1_CreateComputer() { selenium.Open("/Security/Index"); selenium.Click("//a[contains(@href, '/Ban/AddComputers')]"); selenium.WaitForPageToLoad("30000"); selenium.Type("id=ComputerIP", "25.25.26.23"); selenium.Click("//form[@id='form0']/p/input"); selenium.WaitForPageToLoad("30000"); try { Assert.IsTrue(selenium.IsTextPresent("25.25.26.23")); } catch (AssertionException e) { //verificationErrors.Append(e.Message); } selenium.Click("//a[contains(@href, '/Security/Index')]"); selenium.WaitForPageToLoad("30000"); }
public void Google_For_SimpleTalk(SeleniumProvider seleniumProvider) { Browser = seleniumProvider.GetBrowser(); Browser.Open("/"); Browser.Type("q", "Simple Talk"); Browser.Click("btnG"); Browser.WaitForPageToLoad("3000"); Assert.True(Browser.IsTextPresent("www.simple-talk.com")); }
public void Test_RestrictAnonymousFromAccount() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); while (!selenium.IsTextPresent("Sign Out")) { Thread.Sleep(1000); } selenium.Click("SignOutLink"); selenium.WaitForPageToLoad("30000"); selenium.WaitForPageToLoad("30000"); while (!selenium.IsTextPresent("Sign In")) { Thread.Sleep(1000); } selenium.Open("User-Details.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("not signed in"), "Text 'not signed in' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("User Name:"), "Text 'User Name:' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Password:"******"Text 'Password:' not found when it should be."); }
/// <summary> /// To create a Self Excluded customer /// </summary> /// Author: Pradeep /// <param name="myBrowser">Selenium Browser</param> /// <returns>None</returns> /// Created Date: 21-Dec-2011 /// Modified By: /// Modified Date: /// Modification Comments: public string SelfExcludedCustomer(ISelenium myBrowser) { _isUpdateCustomersResourceFile = false; string slfExclCust = "Slf"; // string guidslf = Guid.NewGuid().ToString().Substring(0, 4); DateTime dateFormat = DateTime.Now; string dateTime = (dateFormat.ToString("yyyyMMddHHmmss")); string strUserCreated = _common.CreateCustomer(myBrowser, slfExclCust + dateTime, StrPasswrd); if (strUserCreated != "Fail") { string day = DateTime.Today.Day.ToString(CultureInfo.InvariantCulture); string month = DateTime.Today.Month.ToString(CultureInfo.InvariantCulture); string year = DateTime.Today.Year.ToString(CultureInfo.InvariantCulture); // Getting DDMMYYYY format if (day.Length == 1) { day = "0" + day; } if (month.Length == 1) { month = "0" + month; } // Getting YYYY-MM-DD format string strExclusionDate = year + "-" + month + "-" + day; _common.SearchCustomer(strUserCreated, myBrowser); // Clciking on SelfExcluded user // myBrowser.Click("//input[@name='exclusion_period' and @value='2Y']"); myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.CustomerExcluPeriodLstBx); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.CustomerExcluDateTxtBx, strExclusionDate); // myBrowser.Type("name=exclusion_date", "2011-12-21"); myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.CustomerSelfExlusionBtn); _frameworkCommon.WaitUntilAllElementsLoad(myBrowser); System.Threading.Thread.Sleep(6000); Assert.IsTrue(myBrowser.IsTextPresent("New Self Exclusion Added"), "Self Exclustion is unsuccessfull for this customer"); _isUpdateCustomersResourceFile = _common.UpdateCustomerResouceFile("SelfExcludedCustomer", strUserCreated, StrPasswrd); if (_isUpdateCustomersResourceFile == false) { Framework.BaseTest.Fail("Customers Resource File updation failed."); } } else { Framework.BaseTest.Fail("User creation Failed"); } return(strUserCreated); }
public void Test_Logging() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx?Log=true&Config=true"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Open("Admin/tests/TestLogging.aspx"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Open("Admin/tests/LogContains.aspx?Query=Test group %231"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("LogContains=True"), "Text 'LogContains=True' not found when it should be."); selenium.Open("Admin/tests/LogContains.aspx?Query=Test entry %231"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("LogContains=True"), "Text 'LogContains=True' not found when it should be."); selenium.Open("Admin/tests/LogContains.aspx?Query=Test group %232"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("LogContains=True"), "Text 'LogContains=True' not found when it should be."); selenium.Open("Admin/tests/LogContains.aspx?Query=Test entry %232"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("LogContains=True"), "Text 'LogContains=True' not found when it should be."); }
public void Test_WebSiteSettings() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx?Config=true"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Settings"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=WebSite Settings"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_ApplicationTitle", "Custom Title"); selenium.Click("//input[@value='Update']"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("updated successfully"), "Text 'updated successfully' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Custom Title"), "Text 'Custom Title' not found when it should be."); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Click("link=Sign Out"); selenium.WaitForPageToLoad("30000"); selenium.Open("Edit-WebSiteSettings.aspx"); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); }
public void Test_CreateEditDeleteUser() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Users"); selenium.WaitForPageToLoad("30000"); selenium.WaitForPageToLoad("30000"); selenium.Click("ctl00_Body_ctl00_CreateButton"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_FirstName", "Test1"); selenium.Type("ctl00_Body_ctl00_LastName", "Test1"); selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**"); selenium.Type("ctl00_Body_ctl00_Username", "test1"); selenium.Type("ctl00_Body_ctl00_Password", "pass"); selenium.Type("ctl00_Body_ctl00_PasswordConfirm", "pass"); selenium.AddSelection("ctl00_Body_ctl00_UserRoles", "label=Administrator"); selenium.Click("ctl00_Body_ctl00_SaveButton"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Test1"), "Text 'Test1' not found when it should be."); selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_EditButton"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_FirstName", "Test2"); selenium.Type("ctl00_Body_ctl00_LastName", "Test2"); selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**"); selenium.Type("ctl00_Body_ctl00_Username", "test2"); selenium.RemoveSelection("ctl00_Body_ctl00_UserRoles", "label=Administrator"); selenium.Click("ctl00_Body_ctl00_UpdateButton"); selenium.WaitForPageToLoad("30000"); selenium.ChooseOkOnNextConfirmation(); selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_DeleteButton"); Assert.IsTrue(selenium.GetConfirmation() != null && selenium.GetConfirmation().IndexOf("Are you sure you want to delete this user?") > -1, "Confirm box didn't appear when expected."); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); Assert.IsFalse(selenium.IsTextPresent("Test1"), "Text 'Test1' found when it shouldn't be."); }
public void RegistrationAndLoginTest() { selenium.Open("/index.aspx"); selenium.WaitForPageToLoad("10000"); selenium.Click("link=Login"); selenium.WaitForPageToLoad("10000"); selenium.Click("link=Register"); selenium.WaitForPageToLoad("5000"); selenium.Type("ctl00_body_content_txtEmailAddress", "*****@*****.**"); selenium.Type("ctl00_body_content_txtPassword", "12345"); selenium.Type("ctl00_body_content_txtPasswordConfirm", "12345"); selenium.Type("ctl00_body_content_txtFirstName", "Javier"); selenium.Type("ctl00_body_content_txtLastName", "Mesa"); selenium.Type("ctl00_body_content_txtCompanyName", "XYZ Printing"); selenium.Type("ctl00_body_content_txtPhoneNumber", "7862986707"); selenium.Type("ctl00_body_content_txtBillAddressLine1", "2601 W 2nd Ave"); selenium.Type("ctl00_body_content_txtBillCity", "Hialeah"); selenium.Type("ctl00_body_content_txtBillState", "FL"); selenium.Type("ctl00_body_content_txtBillZipCode", "33010"); selenium.Click("ctl00_body_content_btnRegister"); selenium.WaitForPageToLoad("5000"); int count = userRepo.Users.Where(u => u.email.Trim() == "*****@*****.**").Count(); Assert.AreEqual(1, count); User newUser = userRepo.Users.Where(u => u.email.Trim() == "*****@*****.**").Single(); Assert.AreEqual("Javier", newUser.firstName.Trim()); Assert.AreEqual("Mesa", newUser.lastName.Trim()); Assert.AreEqual("82-7C-CB-0E-EA-8A-70-6C-4C-34-A1-68-91-F8-4E-7B", newUser.password.Trim()); Assert.AreEqual("XYZ Printing", newUser.company.Trim()); Assert.AreEqual("7862986707", newUser.homePhone.Trim()); Assert.AreEqual("2601 W 2nd Ave", newUser.b_address1.Trim()); Assert.AreEqual("Hialeah", newUser.b_city.Trim()); Assert.AreEqual("FL", newUser.b_state.Trim()); Assert.AreEqual("33010", newUser.b_zip.Trim()); selenium.Open("/index.aspx"); selenium.WaitForPageToLoad("5000"); selenium.Click("link=Login"); selenium.WaitForPageToLoad("5000"); selenium.Type("ctl00_body_content_loginEmail", "*****@*****.**"); selenium.Type("ctl00_body_content_pwd", "12345"); selenium.Click("ctl00_body_content_loginSubmit"); selenium.WaitForPageToLoad("5000"); Assert.IsTrue(selenium.IsTextPresent("Welcome back Javier")); }
public void Test_EnforceUniqueUsername() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("Settings"), "Text 'Settings' not found when it should be."); selenium.Click("link=Settings"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=User Settings"); selenium.WaitForPageToLoad("30000"); if (!selenium.IsChecked("ctl00_Body_ctl00_AutoApproveNewUsers")) { selenium.Click("ctl00_Body_ctl00_AutoApproveNewUsers"); } selenium.Click("ctl00_Body_ctl00_UpdateButton"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); selenium.Click("SignOutLink"); selenium.WaitForPageToLoad("30000"); selenium.Click("RegisterLink"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_FirstName", "first"); selenium.Type("ctl00_Body_ctl00_LastName", "last"); selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**"); selenium.Type("ctl00_Body_ctl00_Username", "admin"); selenium.Type("ctl00_Body_ctl00_Password", "pass"); selenium.Type("ctl00_Body_ctl00_PasswordConfirm", "pass"); selenium.Click("ctl00_Body_ctl00_EnableNotifications"); selenium.Click("ctl00_Body_ctl00_RegisterButton"); selenium.WaitForPageToLoad("30000"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("username is already in use"), "Text 'username is already in use' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("New User Details"), "Text 'New User Details' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Register"), "Text 'Register' not found when it should be."); }
public void Test_UserSettings() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx?Config=true"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Settings"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=User Settings"); selenium.WaitForPageToLoad("30000"); if (selenium.IsChecked("ctl00_Body_ctl00_EnableUserRegistration")) { selenium.Click("ctl00_Body_ctl00_EnableUserRegistration"); } selenium.Click("//input[@value='Update']"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("updated successfully"), "Text 'updated successfully' not found when it should be."); selenium.Click("link=Sign Out"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Register"), "Text 'Register' found when it shouldn't be."); selenium.Open("Edit-UserSettings.aspx"); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); }
public void GoogleSearch() { //Opens up Google selenium.Open("http://www.google.com/webhp"); //Verifies that the title matches Assert.AreEqual("Google", selenium.GetTitle()); selenium.Type("q", "Selenium OpenQA"); //Verifies that it can find the Selenium website Assert.AreEqual("Selenium OpenQA", selenium.GetValue("q")); selenium.Click("btnG"); selenium.WaitForPageToLoad("5000"); Assert.IsTrue(selenium.IsTextPresent("www.openqa.org")); Assert.AreEqual("Selenium OpenQA - Google Search", selenium.GetTitle()); }
public void TheUntitled() { var categoryName = Guid.NewGuid().ToString(); var childCategoryName = Guid.NewGuid().ToString(); selenium.Open("/"); selenium.Type("email", "*****@*****.**"); selenium.Type("password", "1"); selenium.Click("//input[@value='Войти']"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=добавить"); selenium.WaitForPageToLoad("30000"); selenium.Type("Name", categoryName); selenium.Click("//input[@value='Создать']"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=список"); selenium.WaitForPageToLoad("30000"); try { Assert.IsTrue(selenium.IsTextPresent(categoryName)); } catch (AssertionException e) { verificationErrors.Append(e.Message); } selenium.Click("link=добавить"); selenium.WaitForPageToLoad("30000"); selenium.Select("ParentId", "label=" + categoryName); selenium.Type("Name", childCategoryName); selenium.Click("//input[@value='Создать']"); selenium.WaitForPageToLoad("30000"); selenium.Click("//div[@id='content']/div/li/ul/li/a"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=список"); selenium.WaitForPageToLoad("30000"); selenium.Click("//div[@id='content']/div/li/ul/li/a"); selenium.WaitForPageToLoad("30000"); try { Assert.AreEqual(categoryName, selenium.GetSelectedLabel("ParentId")); } catch (AssertionException e) { verificationErrors.Append(e.Message); } }
/// <summary> /// Add desired Customer to SelfExcluded User Group /// </summary> /// Author: Anand /// <param name="browser">Selenium Browser</param> /// <param name="customerName">Customer Name</param> public bool SelfExcludedCustomer(ISelenium browser, string customerName) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.CustomersLink, browser); //Selecting TopFrame SelectMainFrame(browser); // Enter Customer Name and Search SearchCustomer(customerName, browser); string day = DateTime.Today.Day.ToString(CultureInfo.InvariantCulture); string month = DateTime.Today.Month.ToString(CultureInfo.InvariantCulture); string year = DateTime.Today.Year.ToString(CultureInfo.InvariantCulture); // Getting DDMMYYYY format if (day.Length == 1) { day = "0" + day; } if (month.Length == 1) { month = "0" + month; } // Getting YYYY-MM-DD format string strExclusionDate = year + "-" + month + "-" + day; browser.Click(AdminSuite.CustomerCreation.CustomersPage.CustomerExcluPeriodLstBx); browser.Type(AdminSuite.CustomerCreation.CustomersPage.CustomerExcluDateTxtBx, strExclusionDate); // myBrowser.Type("name=exclusion_date", "2011-12-21"); browser.Click(AdminSuite.CustomerCreation.CustomersPage.CustomerSelfExlusionBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); System.Threading.Thread.Sleep(10000); if (browser.IsTextPresent("New Self Exclusion Added")) { Console.WriteLine("Self Exclustion is successfull for this customer"); return true; } else { Console.WriteLine("Self Exclustion is unsuccessfull for this customer"); return false; } } catch (Exception ex) { Console.WriteLine(ex.Message); return false; } }
///<summary> /// This method verifies the all the policies on Home page /// <example>VerifyPolicies(MyBrowser)</example> public void VerifyPolicies(ISelenium browser, string[] Policies, string[] URLs) { try { string url, xPath; for (int i = 0; i < Policies.Length; i++) { HGframeworkCommonObj.PageSync(browser); xPath = "//a[starts-with(@class, 'bxc tac sec-button small footer') and contains(text(), '" + Policies[i] + "')]"; Assert.IsTrue(browser.IsElementPresent(xPath), Policies[i] + " button not found"); browser.Click(xPath); HGframeworkCommonObj.PageSync(browser); HGframeworkCommonObj.WaitUntilElementPresent(browser, LoginLogoutControls.alertContainer, "5000"); Thread.Sleep(1000); Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.alertContainer), "Alert container was not displayed on tapping the '" + Policies[i] + "' link"); Assert.IsTrue(browser.IsTextPresent("You are about to navigate away from the site and any selections you have in the betslip may be lost"), "Warning message[1] is not displayed in the Alert container"); Assert.IsTrue(browser.IsTextPresent("Do you want to navigate away?"), "Warning message[2] is not displayed in the Alert container"); browser.Click(LoginLogoutControls.CloseButtonInAlertContainer); HGframeworkCommonObj.PageSync(browser); Assert.IsFalse(browser.IsVisible(LoginLogoutControls.alertContainer), "Alert container failed to close on tapping the Cancel button"); browser.Click(xPath); HGframeworkCommonObj.WaitUntilElementPresent(browser, LoginLogoutControls.alertContainer, "5000"); Thread.Sleep(1000); Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.alertContainer), "Alert container was not displayed on tapping the '" + Policies[i] + "' link"); browser.Click(LoginLogoutControls.ContinueButtonInAlertContainer); HGframeworkCommonObj.PageSync(browser); Thread.Sleep(2000); //Title is different for Desktop policy if (Policies[i] == "Desktop") { HGFcommonObj.SwitchWindow(browser, "Ladbrokes Mobile"); } else { HGFcommonObj.SwitchWindow(browser, "LBR Customer KB"); } url = browser.GetLocation(); // url = driver.Url; browser.Close(); browser.SelectWindow("null"); Thread.Sleep(1000); if (url.ToLower().Trim() == URLs[i].ToLower().Trim()) { Console.WriteLine("'" + Policies[i] + "' validated successfully"); } else { Console.WriteLine("Failed to validate the '" + Policies[i] + "'"); Fail("Mismatch in Actual and Expected URLs"); } } } catch (Exception ex) { Console.WriteLine("Function 'VerifyPolicies' - Failed"); Console.WriteLine(ex.Message); Fail(ex.Message); } }
///<summary> /// This method verifies the details on COntact Us page /// <example>VerifyContactusPage(MyBrowser)</example> public void VerifyContactusPage(ISelenium browser) { try { HGFcommonObj.selectMenuButton(browser); HGFcommonObj.clickObject(browser, LoginLogoutControls.loginOrRegisterLink); Thread.Sleep(1000); Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.lostLoginButton), "Lost Login button is not present in mobile's login page"); HGFcommonObj.clickObject(browser, LoginLogoutControls.lostLoginButton); Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.contactUsBanner), "'Contact us' banner is not present in the Contact Us page"); Assert.IsTrue(browser.IsTextPresent("To speak to our 24 hour Customer Support team please contact us on:"), "Contact Us message is not present in the Contact Us page"); Assert.IsTrue(browser.IsTextPresent("Call us on:"), "'Call us on' message is not present in the Contact Us page"); Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.UKContacts), "UK contact details are not not present in the Contact Us page"); Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.NonUKContacts), "Non UK contact details are not not present in the Contact Us page"); Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.emailContacts), "eMail information is not present in the Contact Us page"); Console.WriteLine("UI Verification of Contact us page via 'Lost Login' was successful"); HGFcommonObj.SelectLinksFromSideBar(browser, "Contact us", "Contact Us"); Assert.IsTrue(browser.IsTextPresent("To speak to our 24 hour Customer Support team please contact us on:"), "Contact Us message is not present in the Contact Us page"); Assert.IsTrue(browser.IsTextPresent("Call us on:"), "'Call us on' message is not present in the Contact Us page"); Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.UKContacts), "UK contact details are not not present in the Contact Us page"); Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.NonUKContacts), "Non UK contact details are not not present in the Contact Us page"); Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.emailContacts), "eMail information is not present in the Contact Us page"); Console.WriteLine("UI Verification of Contact us page via 'Side Menu' was successful"); } catch (Exception ex) { Console.WriteLine("Function 'VerifyContactusPage' - Failed"); Console.WriteLine(ex.Message); Fail(ex.Message); } }
//public Common() //{ // DirectoryInfo CurrentDirPath = new DirectoryInfo(Environment.CurrentDirectory); // ResFilePath = CurrentDirPath.FullName + "\\Resources\\Customers.resx"; // if (!File.Exists(ResFilePath)) // { // ResFilePath = CurrentDirPath.Parent.FullName.ToString(CultureInfo.InvariantCulture) + "\\AdminSuite\\Resources\\Customers.resx"; // AddTestCase("Customers.resx", "Taken from other than the Output directory"); // } // else // { // AddTestCase("Customers.resx", " Taken from the Output directory"); // } //} /// <summary> /// Add a new customer /// </summary> /// Author: Yogesh /// Created Date:21-Dec-2011 /// <param name="myBrowser">Selenium browser</param> /// <param name="strUserName">Customer Name to be created</param> /// <param name="strPassword">Password for the user</param> /// <returns>Customer Created</returns> /// Modified By: Pradeep /// Modified code to return Username public string CreateCustomer(ISelenium myBrowser, string strUserName, string strPassword) { Random rnd = new Random(); string strSignificantDate; string day = DateTime.Today.Day.ToString(CultureInfo.InvariantCulture); string month = DateTime.Today.Month.ToString(CultureInfo.InvariantCulture); string year = DateTime.Today.Year.ToString(CultureInfo.InvariantCulture); // Getting DDMMYYYY format if (day.Length == 1) { day = "0" + day; } if (month.Length == 1) { month = "0" + month; } strSignificantDate = day + month + year; string[] fName = new string[] { "Dylan", "Ethan", "George", "Hary", "Jacob", "John", "Jessica", "Amelia", "Grace", "Emily", "Ruby" }; string[] lName = new string[] { "Brown", "Jones", "Miller", "Roberts", "Taylor", "Wilson" }; string[] pCode = new string[] { "HA2 9SR", "HA2 9SG", "HA2 9SE", "HA2 9SN", "HA2 9SW", "HA2 9SX", "HA2 8SS", "HA2 8SE", "HA2 8SX", "HA2 8SN", "HA2 8SA" }; string firstName = "Auto" + fName[rnd.Next(0, 10)]; string lastName = "Auto" + lName[rnd.Next(0, 5)]; string postCode = pCode[rnd.Next(0, 10)]; string houseNumTxt = rnd.Next(10000).ToString(); string DOBday = rnd.Next(20, 30).ToString(); string DOBmonth = rnd.Next(1, 12).ToString(); if (DOBmonth.Length < 2) { DOBmonth = "0" + DOBmonth; } string DOByear = rnd.Next(1950, 1980).ToString(); string DOB = DOByear + "-" + DOBmonth + "-" + DOBday; try { LHNavigation(AdminSuite.CommonControls.AdminHomePage.CustomersLink, myBrowser); SelectMainFrame(myBrowser); Assert.IsTrue(myBrowser.IsElementPresent(AdminSuite.CustomerCreation.CustomersPage.AddCustomerBtn), "Add Customer button doesn't exist in Customer Search Home Page"); myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.AddCustomerBtn); myBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); // Entering all the field to create UserName myBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.AccDepLstBx, "Deposit"); myBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.EntrUsrNmeTxtBx, strUserName); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.EntrPwdTxtBx, strPassword); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.EntrPwdAgnTxtBx, strPassword); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.SgnfiDateTxtBx, strSignificantDate); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.Chlg1TxtBx, "Challenge1"); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.Resp1TxtBx, "Response1"); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.Chlg2TxtBx, "Challenge2"); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.Resp2TxtBx, "Response2"); myBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.RegChTxtBx, "Internet"); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.FNameTxtBx, firstName); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.LNameTxtBx, lastName); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.HouseNumTxtBx, houseNumTxt); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.Addr2TxtBx, "Ladbrokes Ltd, Imperial Drive"); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.Addr3TxtBx, "Harrow"); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.Addr4TxtBx, ""); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.CityTxtBx, "Middx"); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.PostCodeTxtBx, postCode); myBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.CntryTxtBx, "United Kingdom"); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.TelDialCdeTxtBx, "44"); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.TelPhTxtBx, "1234567890"); System.Threading.Thread.Sleep(100); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.EmailTxtBx, firstName + lastName + "@gmail.com"); myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.GenderRadioButton); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.DobTxtBox, DOB); // Clicking on AddCustomer button myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.AddCustomerBtn); _frameworkCommon.WaitUntilAllElementsLoad(myBrowser); System.Threading.Thread.Sleep(10000); // Writing to Resource file Console.WriteLine("User created is {0}", strUserName); if (myBrowser.IsTextPresent(strUserName)) { return strUserName; } else { return "Fail"; } } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); return "Fail"; } }
/// <summary> /// Change the customer Password /// </summary> /// Author: Kiran /// <param name="browser">browser Instance</param> /// <param name="userName">User Name</param> /// <param name="userName">passwordUser</param> public void ChangeCustomerPassword(ISelenium adminBrowser, string userName, string password) { try { // Enter Customer Name and Search SearchCustomer(userName, adminBrowser); SelectMainFrame(adminBrowser); adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.UpdCustPwdField1, password); adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.UpdCustPwdField2, password); adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdatePassword); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(adminBrowser.IsTextPresent("Successfully changed password"), "Failed to update password"); } catch (Exception ex) { CaptureScreenshot(adminBrowser, ""); Fail(ex.Message); } }
/// <summary> /// Add desired Customer to SelfExcluded User Group /// </summary> /// Author: Anand /// <param name="browser">Browser Instance</param> /// <param name="customerName">Customer Name</param> public bool CompanyExcludedCustomer(ISelenium browser, string customerName) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.CustomersLink, browser); //Selecting TopFrame SelectMainFrame(browser); // Enter Customer Name and Search SearchCustomer(customerName, browser); // browser.Click(AdminSuite.CustomerCreation.CustomersPage.CompanyExcludedCustomerBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); System.Threading.Thread.Sleep(10000); if (browser.IsTextPresent("New Company Exclusion Added")) { return true; } else { return false; } } catch (Exception ex) { Console.WriteLine(ex.Message); return false; } }
public bool AdminRewardAdhoctoken(ISelenium adminBrowser, string custName, string tokenVal, string redemptionVal) { try { int dt = Convert.ToInt32(DateTime.Now.Day.ToString()) + 1; string relativeDate = dt.ToString() + " 12:12"; //Click on Reward Adhoc token link in Admin LHN if (AdminLHNClick("Reward Adhoc token", adminBrowser)) { Console.WriteLine("Successfully clicked on the Admin LHN link Reward Adhoc token"); } else { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to click on the Admin LHN link"); return false; } //Entering value in Username Text box in Reward Adhoc token page if (!AdminTableObjects(adminBrowser, "Reward Adhoc token", "Username", "Text Box", custName, 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to put value in Username Text box in Reward Adhoc token page"); return false; } //click on the Search button in Reward Adhoc token page if (!AdminTableObjects(adminBrowser, "Reward Adhoc token", "", "Button", "Search", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to click on the Search button in Reward Adhoc token page"); return false; } //Entering value in GBP text box in Reward Adhoc token page if (!AdminTableObjects(adminBrowser, "Reward Adhoc token", "GBP", "Text Box", tokenVal, 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to to locate GBP text box in Reward Adhoc token page"); return false; } // Selecting Redemtion Value in Reward Adhoc token page adminBrowser.Select("//select[@name='RValID']", "label=" + redemptionVal); //Entering value in Relative Expiry text box in Reward Adhoc token page if (!AdminTableObjects(adminBrowser, "Reward Adhoc token", "Relative Expiry", "Text Box", relativeDate, 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to to locate Relative Expiry text box in Reward Adhoc token page"); return false; } //click on the Reward token button in Reward Adhoc token page if (!AdminTableObjects(adminBrowser, "Reward Adhoc token", "", "Button", "Reward token", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to click on the Reward token button in Reward Adhoc token page"); return false; } if (!adminBrowser.IsTextPresent("Token Rewarded")) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Success message is not displayed on creating the Token"); return false; } Console.WriteLine("Successfully created Adhoc Token to customer"); return true; } catch (Exception ex) { Console.WriteLine(ex.Message); Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); return false; } }
public bool AdminSearchCustomer(ISelenium adminBrowser, string custName) { try { ///Click on Customers link in Admin LHN if (AdminLHNClick("Customers", adminBrowser)) { Console.WriteLine("Successfully clicked on the Admin LHN link Customers"); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } else { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to click on the Admin LHN link"); return false; } //Entering value in Username Text box in Reward Adhoc token page if (!AdminTableObjects(adminBrowser, "Customer Search Criteria", "Username", "Text Box", custName, 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to put value in Username Text box in Customer Search page"); return false; } adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); //click on the Find Customer button if (!AdminTableObjects(adminBrowser, "Customer Search Criteria", "", "Button", "Find Customer", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable click on Find Customer button in Customer Search page"); return false; } _frameworkCommon.WaitUntilAllElementsLoad(adminBrowser); _frameworkCommon.WaitUntilElementPresent(adminBrowser, "//table//th/font[contains(text(),'Account information')]", FrameGlobals.PageLoadTimeOut); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); //verifying the customer name in page if (!adminBrowser.IsTextPresent(custName)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to verify the customer name in the page"); return false; } Console.WriteLine("Successfully searched the customer"); return true; } catch (Exception ex) { Console.WriteLine(ex.Message); Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); return false; } }
/// <summary> /// Add desired Customer to Banned User Group /// </summary> /// Author: Anand /// <param name="browser">Browser Instance</param> /// <param name="userName">User Name</param> public bool UpdateBannedCountryCustomer(ISelenium browser, string userName, string countryName) { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.CustomersLink, browser); //Selecting TopFrame SelectMainFrame(browser); // Enter Customer Name and Search SearchCustomer(userName, browser); // if (browser.IsElementPresent(AdminSuite.CustomerCreation.CustomersPage.UpdateRegistrationButton)) { browser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateRegistrationButton); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); //const string strBannedCountryName = ; browser.Select(AdminSuite.CustomerCreation.CustomersPage.CntryTxtBx, countryName); browser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateCustomerButton); _frameworkCommon.WaitUntilAllElementsLoad(browser); if (browser.IsTextPresent(countryName)) { //UpdateCustomerStatus(browser, userName, "Active", "-- unset --", "-- unset --"); Console.WriteLine("Change of country to " + countryName + " is successfull"); return true; } else { Console.WriteLine("Change of country to " + countryName + " was unsuccessfull"); return false; } } else { Console.WriteLine("AdminSuite:Common:Fail- Update Registration Button is not Found"); return false; } }
/// <summary> /// Suspend a customer /// </summary> /// Author: Kiran /// <param name="browser">Browser Instance</param> /// <param name="customerName">Customer Name</param> public bool UpdateSuspCust(ISelenium browser, string customerName) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.CustomersLink, browser); //Selecting TopFrame SelectMainFrame(browser); // Enter Customer Name and Search SearchCustomer(customerName, browser); browser.Select("name=Status", "label=Suspended"); browser.Select("name=StatusReasonType", "label=Test Accounts"); browser.Select("name=StatusReason", "label=Test Account: No Longer Required"); browser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateCustomerButton); _frameworkCommon.WaitUntilAllElementsLoad(browser); System.Threading.Thread.Sleep(10000); if (browser.IsTextPresent("Current Customer Status: Suspended")) { return true; } else { return false; } } catch (Exception ex) { Console.WriteLine(ex.Message); return false; } }
/// <summary> /// Stores age evrification details for a customer /// </summary> /// Author: Kiran /// <param name="browser">browser Instance</param> /// <param name="userName">User Name</param> /// <param name="segmentType">HVC</param> /// <param name="segmentVal">Yes</param> public bool StoreAgeVerification(ISelenium adminBrowser, string userName, string ageVerStatus, int ovsScore, string ovsRef, string notes, string driverLinNo) { try { // Enter Customer Name and Search SearchCustomer(userName, adminBrowser); SelectMainFrame(adminBrowser); adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.custVerificationBtn); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(adminBrowser.IsElementPresent(AdminSuite.CustomerCreation.CustomersPage.ageVerfStatusPassRdo), "Customer Verification page not loaded"); if (ageVerStatus.ToLower() == "pass") { adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.ageVerfStatusPassRdo); } else { adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.ageVerfStatusFailRdo); } adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.ovsReferenceTxt, ovsRef); adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.notesTxt, notes); adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.driversRdo); adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.driverNoTxt, driverLinNo); adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.strVerificationBtn); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(adminBrowser.IsTextPresent("Verification check stored successfully for customer"), "Failed to store verification"); return true; } catch (Exception ex) { CaptureScreenshot(adminBrowser, ""); Console.WriteLine(ex); return false; } }
/// <Summary> /// Do Manual Adjustment /// Author: Kiran /// </Summary> public bool PerformManualAdjustment(ISelenium adminBrowser, string customerName, string typeGroup, string amount, string withdrawal, string type, string description, string dateFrom, string dateTo, string dateRange) { try { bool bStatus = false; SearchCustomer(customerName, adminBrowser); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); //Selecting TopFrame SelectMainFrame(adminBrowser); adminBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.typeGrouplstBox, typeGroup); adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.amountFld, amount); adminBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.withdrawableLst, withdrawal); adminBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.typeLstBox, type); adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.descriptionFld, description); if (!string.IsNullOrEmpty(dateFrom)) { adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.dateFromFld, Convert.ToDateTime(dateFrom).ToString("yyyy-MM-dd hh:mm:ss")); } if (!string.IsNullOrEmpty(dateTo)) { adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.dateToFld, Convert.ToDateTime(dateTo).ToString("yyyy-MM-dd hh:mm:ss")); } adminBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.dateRangeLst, dateRange); adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.ManAdjBtn); adminBrowser.ChooseOkOnNextConfirmation(); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(adminBrowser.IsTextPresent("Manual Adjustment Successful"), "Failed to do Manual Adjustment"); bStatus = true; return bStatus; } catch (Exception ex) { CaptureScreenshot(adminBrowser, ""); Fail(ex.Message); return false; } }
/// <summary> /// To Search Customer by CustomerName /// </summary> /// Author: Pradeep /// <param name="strCustomerName"> </param> /// <param name="myBrowser"> </param> /// Ex: Adit_Test_SelfExcluded /// <returns>None</returns> /// Created Date: 21-Dec-2011 /// Modified Date: 21-Dec-2011 /// Modification Comments: public void SearchCustomer(string strCustomerName, ISelenium myBrowser) { try { LHNavigation(AdminSuite.CommonControls.AdminHomePage.CustomersLink, myBrowser); // Navigating to RHN SelectMainFrame(myBrowser); _frameworkCommon.WaitUntilElementPresent(myBrowser, AdminSuite.CustomerCreation.CustomersPage.CusSearUsernameTxtBx, "60"); if (myBrowser.IsElementPresent(AdminSuite.CustomerCreation.CustomersPage.CusSearUsernameTxtBx)) { myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.CusSearUsernameTxtBx, strCustomerName); } else { myBrowser.Type("name=Username", strCustomerName); } myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.FindCustomerUnBtn); Thread.Sleep(10000); myBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(myBrowser.IsTextPresent(strCustomerName), "Customer information is not found"); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } }
/// <summary> /// Makes a suspended cust active /// </summary> /// Author: Kiran /// <param name="customerName">Customer Name</param> /// <param name="browser">Browser Instance</param> public void ReleaseSuspCust(string customerName, ISelenium browser) { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.CustomersLink, browser); //Selecting TopFrame SelectMainFrame(browser); // Enter Customer Name and Search SearchCustomer(customerName, browser); browser.Select("name=Status", "label=Active"); browser.Select("name=StatusReasonType", "label=-- unset --"); browser.Select("name=StatusReason", "label=-- unset --"); browser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateCustomerButton); _frameworkCommon.WaitUntilAllElementsLoad(browser); System.Threading.Thread.Sleep(10000); if (browser.IsTextPresent("Current Customer Status: Active")) { Console.WriteLine("AdminSuite:ReleaseSelfExcludedUser-Pass- Customer made Active"); } else { Console.WriteLine("AdminSuite:ReleaseSelfExcludedUser-Fail- Customer remains Suspended"); } }
/// <summary> /// releases any SelfExcluded User /// </summary> /// Author: Anand /// <param name="browser">Browser</param> /// <param name="userName">User Name</param> public void ReleaseSelfExcludedUser(ISelenium browser, string userName) { try { decimal numberOfSelfExcludedLink; //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.CustomersLink, browser); //Selecting TopFrame SelectMainFrame(browser); // Enter Customer Name and Search SearchCustomer(userName, browser); // Getting number of SelfExcluded Link numberOfSelfExcludedLink = browser.GetXpathCount(AdminSuite.CustomerCreation.CustomersPage.NoOfSelfExcludedCustomer); if (numberOfSelfExcludedLink > 0) { for (int i = 0; i < numberOfSelfExcludedLink; i++) { browser.Click(AdminSuite.CustomerCreation.CustomersPage.NoOfSelfExcludedCustomer); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); System.Threading.Thread.Sleep(10000); if (!browser.IsTextPresent("Application Error")) { if (browser.IsElementPresent("//input[@type='submit' and @value='Confirm']")) { browser.Click("//input[@type='submit' and @value='Confirm']"); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); System.Threading.Thread.Sleep(10000); } } } } else { Console.WriteLine("AdminSuite:ReleaseSelfExcludedUser-Fail- Customer is not SelfExcluded"); } Assert.IsTrue(browser.IsTextPresent("Self exclusion successfully removed"), "Failed to clear SelfExclusion for customer"); Console.WriteLine("AdminSuite:ReleaseSelfExcludedUser-Pass- Cleared the SelfExcluded"); } catch (Exception ex) { Console.WriteLine(ex.Message); } }