public void Init() { //Deleting cookies in ie browser through command line. /*var procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2"); var proc = new System.Diagnostics.Process { StartInfo = procStartInfo }; proc.Start(); WebDriverObj = new InternetExplorerDriver(); */ string URL = "https://stg-gib.ladbrokes.com/admin"; WebDriverObj = new FirefoxDriver(); MyBrowser = new WebDriverBackedSelenium(WebDriverObj, URL); MyBrowser.Start(); WebDriverObj.Manage().Window.Maximize(); MyBrowser.WindowMaximize(); MyBrowser.Open(URL); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); MyBrowser.Refresh(); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); MyBrowser.Type(TestDataCreation.ControlsRepository.UsrNmeTxtBx, "Automation1"); MyBrowser.Type(TestDataCreation.ControlsRepository.PwdTxtBx, "aditi123"); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); MyBrowser.Click(TestDataCreation.ControlsRepository.LoginBtn); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); }
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 TheFIASimpleTest(string dateNaissJ, string dateNaissM, string dateNaissA, string nom, string prenom, string numVoie, string codePostal, string burDistr, string numICCID, string numIMEI) { selenium.Click("bt_4_0"); selenium.WaitForPageToLoad("30000"); selenium.Type("dateNaissJ", dateNaissJ); selenium.Type("dateNaissM", dateNaissM); selenium.Type("dateNaissA", dateNaissA); selenium.Click("document.fiaForm.codeDptNaiss[1]"); selenium.Select("document.fiaForm.codeDptNaiss[1]", "label=ALLIER"); selenium.Click("//option[@value='03']"); selenium.Select("civilite", "label=Madame"); selenium.Type("nom", nom); selenium.Type("prenom", prenom); selenium.Click("//img[@onclick='ChangerOnglet(2)']"); selenium.Type("numVoie", numVoie); selenium.Type("codePostal", codePostal); selenium.Type("burDistr", burDistr); selenium.Click("//img[@onclick='ChangerOnglet(3)']"); selenium.Type("numICCID", numICCID); selenium.Type("numIMEI", numIMEI); selenium.Click("B2"); selenium.WaitForPageToLoad("30000"); selenium.Click("//img[@onclick='valider()']"); selenium.WaitForPageToLoad("30000"); }
// UpdateResourceFile("pradeep","@E:\AdminScripts\ECommerce_CodeBase\PreRequisite_Suite\Resources\Customers.resx"); /// <summary> To Launch the browser & to login to Open Bet application /// </summary> /// Author: Yogesh /// Ex: AdminBase.init() /// <returns>None</returns> /// Created Date: 22-Dec-2011 /// Modified Date: /// Modification Comments: public void Init() { if (FrameGlobals.useGrid.ToUpper() == "YES") { FirefoxProfile ffProfile = new FirefoxProfile(); DesiredCapabilities desriredCapibilities = null; desriredCapibilities = new DesiredCapabilities(); desriredCapibilities = DesiredCapabilities.Firefox(); desriredCapibilities.SetCapability(CapabilityType.BrowserName, "firefox"); // ffProfile.SetPreference("general.useragent.override", FrameGlobals.userAgentValue); FfDriver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), desriredCapibilities, TimeSpan.FromSeconds(420.0)); MyBrowser = new WebDriverBackedSelenium(FfDriver, "http://www.google.com"); //_seleniumContainer.Add(Gallio.Framework.TestContext.CurrentContext.Test.Name, MyBrowser); } else { FfDriver = new FirefoxDriver(); MyBrowser = new WebDriverBackedSelenium(FfDriver, FrameGlobals.OBUrl); //MyBrowser = new WebDriverBackedSelenium(FfDriver, "https://stg-gib.ladbrokes.com/admin"); } MyBrowser.Start(); MyBrowser.Open(FrameGlobals.OBUrl); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); MyBrowser.Type(AdminSuite.CommonControls.AdminHomePage.UsrNmeTxtBx, FrameGlobals.AdminName); MyBrowser.Type(AdminSuite.CommonControls.AdminHomePage.PwdTxtBx, FrameGlobals.AdminPass); // MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); MyBrowser.Click(AdminSuite.CommonControls.AdminHomePage.LoginBtn); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut.ToString()); // MyBrowser.WindowMaximize(); FfDriver.Manage().Window.Maximize(); }
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 TheConnexionTestTest(string idUser, string pass) { selenium.Open("/KARA_WEB/deconnexion.do"); selenium.Type("idUtilisateur", idUser); selenium.Type("motDePasse", pass); selenium.Click("B1"); selenium.WaitForPageToLoad("30000"); }
public void CreateCourse() { selenium.WaitForPageToLoad("30000"); selenium.Click("link=Create New"); selenium.WaitForPageToLoad("30000"); selenium.Type("id=Name", "Test"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); }
private void setupBrowser() { // NOTE: These base URLs only work for systems who happen to have the same integration and localhost suffix (For example, localhost/RlePersonnel and integration.redstapler.biz/RlePersonnel). // Systems like MITCalendar will not work until we come up with a better solution. // NOTE: This should not be hard-coded. var baseUrl = "https://integration.redstapler.biz/"; if (AppTools.IsDevelopmentInstallation) { if (ConfigurationStatics.InstallationConfiguration.WebApplications.Any(wa => wa.SupportsSecureConnections)) { baseUrl = "https://localhost/"; } else { baseUrl = "http://localhost/"; } } selenium = new DefaultSelenium("localhost" /*location of Selenium server*/, 4444, @"*firefox3 C:\Program Files (x86)\Mozilla Firefox\firefox.exe", baseUrl); selenium.Start(); if (AppTools.IsIntermediateInstallation) { executeSeleniumBlock( "Intermediate log on", delegate { // NOTE: We need to go to the specific URL here instead of relying on a redirect, or Selenium will time out or otherwise fail (it sucks at following redirects). selenium.Open("/" + ConfigurationStatics.InstallationConfiguration.SystemShortName + "/Ewf/IntermediateLogIn.aspx?ReturnUrl="); // NOTE: Does not work for MIT Calendar, etc. selenium.Type("ctl00_ctl00_main_contentPlace_ctl12_theTextBox", ConfigurationStatics.SystemGeneralProvider.IntermediateLogInPassword); // NOTE: Move g8Summit to machine configuration file. SubmitForm(selenium); selenium.WaitForPageToLoad("30000"); }); } if (UserManagementStatics.UserManagementEnabled && FormsAuthStatics.FormsAuthEnabled) { executeSeleniumBlock( "Forms log on", delegate { // NOTE: System-name approach suffers from same problem as above. selenium.Open("/" + ConfigurationStatics.InstallationConfiguration.SystemShortName + "/Ewf/UserManagement/LogIn.aspx?ReturnUrl="); // NOTE: I don't think we need waits after opens. selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.GetTitle().EndsWith("Log In")); // NOTE: For RSIS, we need the ability to pass a different email address and a different password for testing. selenium.Type("ctl00_ctl00_main_contentPlace_emailAddress_theTextBox", ConfigurationStatics.SystemGeneralProvider.FormsLogInEmail); selenium.Type("ctl00_ctl00_main_contentPlace_password_theTextBox", ConfigurationStatics.SystemGeneralProvider.FormsLogInPassword); SubmitForm(selenium); selenium.WaitForPageToLoad("30000"); }); } }
public void StandartLoginValid() { 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')]")); }
public void TheMercuryTour_03_RemoteControlTest() { selenium.Open("http://newtours.demoaut.com/"); Assert.AreEqual("Welcome: Mercury Tours", selenium.GetTitle()); selenium.Type("name=userName", "invalidUN"); selenium.Type("name=password", "invalidPW"); selenium.Click("name=login"); selenium.WaitForPageToLoad("30000"); }
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 TheIniciarSesionCorrectoTest() { selenium.Open("/"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("Mantenimiento Cliente", selenium.GetText("link=Mantenimiento Cliente")); }
public void LoginAsAdmin() { 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); Assert.IsFalse(selenium.IsElementPresent("//a[contains(@href, '/Account/TeacherToAdminUpgrade')]")); }
public void SetupTest() { selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://127.0.0.1:1556/"); selenium.Start(); verificationErrors = new StringBuilder(); selenium.Open("/"); selenium.Type("id=loginPassword", "lex"); selenium.Type("id=loginUsername", "lex"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad("30000"); }
public void Init() { firefox = new FirefoxDriver(); browser = new WebDriverBackedSelenium(firefox, "http://cms.uat-ecommerce.ladbrokes.com/hmc/hybris?wid=MC57x0"); browser.Start(); browser.Open("http://cms.uat-ecommerce.ladbrokes.com/hmc/hybris?wid=MC57x0"); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut.ToString()); browser.Type("id=Main_user", "mallikarjunmp"); browser.Type("id=Main_password", "12345"); browser.Click("id=Main_label"); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut.ToString()); }
public void Login() { selenium = new DefaultSelenium("localhost", 4444, "*chrome", ConfigurationManager.AppSettings["SELENIUM_URL"]); selenium.Start(); selenium.Open("/"); selenium.Type("id=loginUsername", "lex"); selenium.Type("id=loginPassword", "lex"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad("30000"); selenium.Click("//a[contains(@href, 'UserActivity/Index')]"); selenium.WaitForPageToLoad("30000"); }
public void DisplayUserAvatar() { 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); Assert.IsTrue(selenium.IsElementPresent("avatar")); }
public void Login() { selenium = new DefaultSelenium("localhost", 4444, "*chrome", ConfigurationManager.AppSettings["SELENIUM_URL"]); selenium.Start(); selenium.Open("/"); selenium.Type("id=loginUsername", "prof"); selenium.Type("id=loginPassword", "prof"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad("40000"); selenium.Click("link=Courses"); selenium.WaitForPageToLoad("40000"); }
public void Login() { selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://127.0.0.1:1556/"); selenium.Start(); selenium.Open("/"); selenium.Type("id=loginUsername", "lex"); selenium.Type("id=loginPassword", "lex"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad("30000"); selenium.Click("//a[contains(@href, 'UserActivity/Index')]"); selenium.WaitForPageToLoad("30000"); }
public void Login() { selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://127.0.0.1:1556/"); selenium.Start(); selenium.Open("/"); selenium.Type("id=loginUsername", "prof"); selenium.Type("id=loginPassword", "prof"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Courses"); selenium.WaitForPageToLoad("30000"); }
public void DisplayUserAvatar() { selenium.Open("/"); selenium.Type("loginPassword", "lex"); selenium.Type("loginUsername", "lex"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Users"); selenium.WaitForPageToLoad("30000"); selenium.Click("//div[@id='main']/table/tbody/tr[3]/td[7]/a[3]"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsElementPresent("avatar")); }
public void Init() { FfDriver = new FirefoxDriver(); MyBrowser = new WebDriverBackedSelenium(FfDriver, "https://stg-gib.ladbrokes.com/admin"); MyBrowser.Start(); MyBrowser.Open("https://stg-gib.ladbrokes.com/admin"); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); MyBrowser.Type(AdminSuite.CommonControls.AdminHomePage.UsrNmeTxtBx, "sanjeeva_p"); MyBrowser.Type(AdminSuite.CommonControls.AdminHomePage.PwdTxtBx, "123456"); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); MyBrowser.Click(AdminSuite.CommonControls.AdminHomePage.LoginBtn); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); }
public void TheLogOutTest() { selenium.Open("/Home/Login"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("LstCliente", selenium.GetText("css=h2")); selenium.Click("id=logout"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); }
public void TheEliminarCancelarTest() { selenium.Open("/Home/Login"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("LstCliente", selenium.GetText("css=h2")); selenium.ChooseCancelOnNextConfirmation(); selenium.Click("xpath=(//a[@onclick=\"return confirm('Desea aliminar')\"])[13]"); Assert.AreEqual("Desea aliminar", selenium.GetConfirmation()); Assert.AreEqual("LstCliente", selenium.GetText("css=h2")); }
public void TheEditarCancelarTest() { selenium.Open("/Home/Login"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); selenium.Click("//a[contains(@href, '/Home/EditarCliente?ClienteId=130')]"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Cancelar"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("LstCliente", selenium.GetText("css=h2")); }
public void TheEliminarCorrectoTest() { selenium.Open("/Home/Login"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("LstCliente", selenium.GetText("css=h2")); selenium.Click("xpath=(//a[@onclick=\"return confirm('Desea aliminar')\"])[13]"); Assert.AreEqual("Desea aliminar", selenium.GetConfirmation()); selenium.WaitForPageToLoad("3000"); Assert.AreEqual("Se elimino satisfactoriamente el cliente", selenium.GetText("css=div.validation-summary-errors")); }
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 TheTectscompleteTest() { selenium.Open("/_int_/config_to.html"); selenium.Click("id=aggressive"); selenium.Type("id=serverlist", "10.105.74.54"); selenium.Click("link=Submit"); }
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); } }
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 TheRegistrarCamposVaciosTest() { selenium.Open("/Home/Login"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("Mantenimiento Cliente", selenium.GetText("link=Mantenimiento Cliente")); selenium.Click("link=Agregar"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("RegistrarCliente", selenium.GetText("css=h2")); selenium.Click("css=button.btn.btn-default"); Assert.AreEqual("Desea Registrar", selenium.GetConfirmation()); selenium.WaitForPageToLoad("3000"); Assert.AreEqual("Ingresar Campos Faltantes", selenium.GetText("css=div.validation-summary-errors")); }
public void TheEditarCorrectoTest() { selenium.Open("/Home/Login"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("LstCliente", selenium.GetText("css=h2")); selenium.Click("//a[contains(@href, '/Home/EditarCliente?ClienteId=130')]"); selenium.WaitForPageToLoad("30000"); selenium.Type("id=DNI", "12345677"); selenium.Click("css=button.btn.btn-default"); Assert.AreEqual("Desea Editar al cliente", selenium.GetConfirmation()); selenium.WaitForPageToLoad("3000"); Assert.AreEqual("Se Edito satisfactoriamente el cliente", selenium.GetText("css=div.validation-summary-errors")); }
public void TheNewTest() { selenium.Open("/"); selenium.Type("q", "selenium rc"); selenium.Click("btnG"); selenium.WaitForPageToLoad("30000"); Console.WriteLine("selenium rc - Google Search" + "/Vs/" + selenium.GetTitle()); }
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")); }
// Login with testing account public static void Login(ISelenium selenium) { for (int i = 0; i < 100; i++) { if (selenium.IsElementPresent("username") == true) { selenium.Type("username", "NvQA"); selenium.Type("password", "bJn#8xg4"); selenium.Type("captcha", "11111"); // The captcha wont be validated when user is NvQA selenium.Click("SubmitButton"); break; } else { Thread.Sleep(50); } } selenium.WaitForPageToLoad("15000"); }
public void TestMethod3() { string URL = "http://www.abb.com"; selenium = new DefaultSelenium("localhost", 4444, "*firefox", URL); selenium.Start(); selenium.Open("/"); Assert.AreEqual("The ABB Group - Automation and Power Technologies", selenium.GetTitle()); selenium.Type("searchInput", "Robot"); selenium.Click("search"); selenium.WaitForPageToLoad("10000"); Assert.AreEqual("The ABB Group", selenium.GetTitle()); Assert.AreEqual("Robot", selenium.GetValue("searchInput")); }
///<summary> /// This method captures the error message displayed when attempts to login with invalid credentials /// <example>CaptureLoginErrorMessage(browser, "ecomm_test_user", "123456")</example> public string CaptureLoginErrorMessage(ISelenium browser, string userName, string password) { try { IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver; LFcommonObj.selectMenuButton(browser); LFcommonObj.clickObject(browser, LoginLogoutControls.loginOrRegisterLink); LFframeworkCommonObj.WaitUntilElementEditable(browser, LoginLogoutControls.loginUsernameTextBox, "10000"); Assert.IsTrue(browser.IsVisible(LoginLogoutControls.loginBanner), "Login page not displayed"); Assert.IsTrue(browser.IsVisible(LoginLogoutControls.loginUsernameTextBox), "Username field not presesnt in Login page"); Assert.IsTrue(browser.IsVisible(LoginLogoutControls.loginPasswordTextBox), "Password field not presesnt in Login page"); browser.Type(LoginLogoutControls.loginUsernameTextBox, ""); if (userName != null) { browser.Type(LoginLogoutControls.loginUsernameTextBox, userName); } browser.Type(LoginLogoutControls.loginPasswordTextBox, ""); if (password != null) { browser.Type(LoginLogoutControls.loginPasswordTextBox, password); } browser.FireEvent(LoginLogoutControls.loginSubmitButton, "click"); LFcommonObj.WaitForLoadingIcon(browser, FrameGlobals.IconLoadTimeout); Thread.Sleep(1000); return driver.FindElement(By.XPath(LoginLogoutControls.loginErrorpanel)).Text; } catch (Exception ex) { Console.WriteLine("Function 'CaptureLoginErrorMessage' - Failed"); Console.WriteLine(ex.Message); Fail(ex.Message); return null; } }
public void TestMethod1() { selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://www.google.com/"); selenium.Start(); selenium.Open("/"); selenium.Type("q", "selenium rc"); selenium.Click("btnG"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("selenium rc - Google Search", selenium.GetTitle()); try { selenium.Stop(); } catch (Exception) { // Ignore errors if unable to close the browser } }
public void TestMethod2() { selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://localhost:1987"); selenium.Start(); selenium.Open("/WebSite1/"); selenium.Type("MainContent_TextBox1", "HUM"); selenium.Click("MainContent_Button1"); selenium.WaitForPageToLoad("3000770"); //Get the Table Value of Row 1 and Coulumn 2 object GG = selenium.GetTable("MainContent_GridView1.1.2"); Assert.AreEqual("1", "1"); try { selenium.Stop(); } catch (Exception) { // Ignore errors if unable to close the browser } }
/// <summary> Updates the PayoutFraction /// Author: Yogesh /// Date Created: FEb 29 2012 /// </summary> /// <param name="browser">Selenium browser Instance</param> /// <param name="selectionId">Selection Id of the selection</param> /// <param name="updatePayoutFractionNumerator">Payout fraction numerator</param> /// <param name="updatePayoutFractionDenominator">Payout fraction denominator</param> /// Ex: UpdatePayourFraction(browser, "12345678", "1", "2", "3"); /// Returns: Nothing public void UpdatePayoutFraction(ISelenium browser, string selectionId, string updatePayoutFractionNumerator, string updatePayoutFractionDenominator) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionId); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton); //click on back button string payoutFractionNumerator = browser.GetText("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacNum']"); string payoutFractionDenominator = browser.GetText("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacDen']"); if (String.IsNullOrWhiteSpace(payoutFractionNumerator) && String.IsNullOrWhiteSpace(payoutFractionDenominator)) { browser.Type("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacNum']", updatePayoutFractionNumerator); browser.Type("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacDen']", updatePayoutFractionDenominator); } // Updating the market details page browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Message); } }
/// <Summary> /// Update start date of an Event /// Author: Kiran /// </Summary> public bool UpdateEventStartDate(ISelenium adminBrowser, string catName, string eventClsName, string eventTypeName, string eventSubType, string eventName, DateTime date) { try { string x = date.ToString("yyyy-MM-dd hh:mm:ss"); //Eg:2013-04-29 15:00:00 bool bStatus = false; bStatus = SearchEvent(adminBrowser, catName, eventClsName, eventTypeName, eventSubType, eventName); //Selecting TopFrame SelectMainFrame(adminBrowser); adminBrowser.Type("//input[@id='start_time']", date.ToString()); adminBrowser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); return bStatus; } catch (Exception ex) { CaptureScreenshot(adminBrowser, ""); Fail(ex.Message); return false; } }
public void UpdateEventsByEventID(ISelenium browser, string eventID, string eventStatus, string eventDisplayed) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.WaitForFrameToLoad(AdminSuite.CommonControls.AdminHomePage.EventNameLink, FrameGlobals.PageLoadTimeOut); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, eventID); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyLevelEvent); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); if (string.Empty != eventStatus) { if (eventStatus == "Suspend") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox, "label=Suspended"); } else if (eventStatus == "Active") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox, "label=Active"); } else { throw new AutomationException("Event status is invalid."); } browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } if (string.Empty != eventDisplayed) { if (eventDisplayed == "Yes") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventDisplayStatusLstBx, "label=Yes"); } else if (eventDisplayed == "No") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventDisplayStatusLstBx, "label=No"); } else { throw new AutomationException("Event displayed is invalid."); } } //Updating the Event if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn)) { browser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "Event Updation is not Successfull"); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Message); //return null; } }
///<summary> /// This method creates a customer with the same details of a self exclusion customer /// <example>RegisterCustomer_selfExclusion(portalbrowser, adminbrowser) </example> public void RegisterCustomer_selfExclusion(ISelenium browser, ISelenium adminBrowser) { try { string regMsg, gender, xPath; var admincommonObj = new AdminSuite.Common(); Random rnd = new Random(); int rndNumber = rnd.Next(10000); //get details of customer in OB adminBrowser.WindowFocus(); string username = "******" + rndNumber; admincommonObj.SelectMainFrame(adminBrowser); string firstname = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'First Name:')]/following-sibling::td"); string lastname = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Last Name:')]/following-sibling::td"); string title = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Title:')]/following-sibling::td"); if (title.ToLower() == "mr") { gender = "male"; } else { gender = "female"; } string dob = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Date of Birth:')]/following-sibling::td"); string[] arr = dob.Split('-'); string DOByear = arr[0]; System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); string DOBmonth = mfi.GetMonthName(int.Parse(arr[1])).ToString(); string DOBday = arr[2]; string houseno = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Address (1)')]/following-sibling::td"); string postcode = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Postcode:')]/following-sibling::td"); string address1 = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(2)')]/following-sibling::td") + adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(3)')]/following-sibling::td"); string address2 = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(3)')]/following-sibling::td"); string city = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'City:')]/following-sibling::td"); string email = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Email:')]/following-sibling::td"); string teleCode = "+44"; string telnumber = "1234567890"; string mobnumber = "1234512345"; string password = "******"; string confirmPassword = "******"; string securityQuestion = "Favourite Colour"; string securityAnswer = "Blue"; string accountCurrency = "UK Pound Sterling"; string country = "United Kingdom"; browser.WindowFocus(); WaitForLoadingIcon_MobileLobby(browser, FrameGlobals.IconLoadTimeout); Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration Page is not displayed"); //Enter data in all the fields browser.Type(MobileLobbyControls.promocode, ""); browser.Select(MobileLobbyControls.title, title); browser.Type(MobileLobbyControls.firstname, firstname); browser.Type(MobileLobbyControls.lastname, lastname); //gender if (gender.ToLower().Trim() == "male") { browser.Click(MobileLobbyControls.genderMale); } else { browser.Click(MobileLobbyControls.genderFemale); } browser.Select(MobileLobbyControls.DOBday, DOBday); browser.Select(MobileLobbyControls.DOBmonth, DOBmonth); browser.Select(MobileLobbyControls.DOByear, DOByear); browser.Select(MobileLobbyControls.country, country); browser.Type(MobileLobbyControls.housename, houseno); browser.Type(MobileLobbyControls.postcode, postcode); browser.Type(MobileLobbyControls.address1, address1); browser.Type(MobileLobbyControls.address2, address2); browser.Type(MobileLobbyControls.city, city); browser.Type(MobileLobbyControls.email, email); browser.Type(MobileLobbyControls.telintcode, teleCode); browser.Type(MobileLobbyControls.telnumber, telnumber); browser.Type(MobileLobbyControls.mobintcode, teleCode); browser.Type(MobileLobbyControls.mobnumber, mobnumber); browser.Select(MobileLobbyControls.accountCurrency, accountCurrency); browser.Type(MobileLobbyControls.username, username); browser.Type(MobileLobbyControls.password, password); browser.Type(MobileLobbyControls.confirmPassword, confirmPassword); browser.Select(MobileLobbyControls.securityQuestion, securityQuestion); browser.Type(MobileLobbyControls.securityAnswer, securityAnswer); MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.contactMe, "on"); MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.aggreement, "on"); Thread.Sleep(1000); //Validate registration clickObject_MobileLobby(browser, MobileLobbyControls.registerNow); Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration page title was not found in the header after registration"); Assert.IsTrue(browser.IsVisible(MobileLobbyControls.failureRgMsg), "Registration failure message was not displayed"); regMsg = "We are sorry but your country of residence is currently prohibited from using the Ladbrokes service."; xPath = "//ul[@class='error_align']/li[contains(text()[2], '" + regMsg + "')]"; Assert.IsTrue(browser.IsElementPresent(xPath), "Registration failure message was not displayed to the user"); Assert.IsTrue(browser.IsVisible(MobileLobbyControls.contactMessage), "Customer contact message was not displayed on failing to create a customer from banned country"); Console.WriteLine("Customer was not registered as his details provided matched a self excluded customer"); } catch (Exception ex) { CaptureScreenshot(browser, "EnterRegisterDetails"); Console.WriteLine("Function 'EnterRegisterDetails' - Failed"); Console.WriteLine(ex.Message); Fail(ex.Message); } }
///<summary> /// This method enters all details of a customer /// <example>EnterRegisterDetails(browser) </example> public string EnterRegisterDetails(ISelenium browser, string promocode, string country, string accountCurrency, string DOByear, string firstname, string lastname, string username) { try { IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver; Random rnd = new Random(); int rndNumber = rnd.Next(10000); 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 title = "Mr"; string gender = "male"; string DOBmonth = "January"; string DOBday = rnd.Next(20, 30).ToString(); string houseno = rndNumber.ToString(); string postcode = pCode[rnd.Next(0, 10)];; string address1 = "Ladbrokes Ltd, Imperial Drive"; string address2 = "Harrow"; string city = "Middx"; string email = firstname + lastname + "@gmail.com"; string teleCode = "+44"; string telnumber = "1234567890"; string mobnumber = "1234512345"; string password = "******"; string confirmPassword = "******"; string securityQuestion = "Favourite Colour"; string securityAnswer = "Blue"; WaitForLoadingIcon_MobileLobby(browser, FrameGlobals.IconLoadTimeout); Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration Page is not displayed"); //Enter data in all the fields browser.Type(MobileLobbyControls.promocode, promocode); browser.Select(MobileLobbyControls.title, title); browser.Type(MobileLobbyControls.firstname, firstname); browser.Type(MobileLobbyControls.lastname, lastname); //gender if (gender.ToLower().Trim() == "male") { browser.Click(MobileLobbyControls.genderMale); } else { browser.Click(MobileLobbyControls.genderFemale); } browser.Select(MobileLobbyControls.DOBday, DOBday); browser.Select(MobileLobbyControls.DOBmonth, DOBmonth); browser.Select(MobileLobbyControls.DOByear, DOByear); if ((DateTime.Now.Year - int.Parse(DOByear)) < 18) { Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration Page is not displayed"); string xPath = "//div[@class='monthformError parentFormundefined formError']/div[@class='formErrorContent' and contains(text(), 'You are under 18')]"; Assert.IsTrue(browser.IsElementPresent(xPath), "'You are under 18' error message was not displayed"); } browser.Select(MobileLobbyControls.country, country); browser.Type(MobileLobbyControls.housename, houseno); browser.Type(MobileLobbyControls.postcode, postcode); if (country.ToLower() == "united kingdom") { clickObject_MobileLobby(browser, MobileLobbyControls.findaddress); } browser.Type(MobileLobbyControls.address1, address1); browser.Type(MobileLobbyControls.address2, address2); browser.Type(MobileLobbyControls.city, city); browser.Type(MobileLobbyControls.email, email); browser.Type(MobileLobbyControls.telintcode, teleCode); browser.Type(MobileLobbyControls.telnumber, telnumber); browser.Type(MobileLobbyControls.mobintcode, teleCode); browser.Type(MobileLobbyControls.mobnumber, mobnumber); browser.Select(MobileLobbyControls.accountCurrency, accountCurrency); browser.Type(MobileLobbyControls.username, username); browser.Type(MobileLobbyControls.password, password); browser.Type(MobileLobbyControls.confirmPassword, confirmPassword); browser.Select(MobileLobbyControls.securityQuestion, securityQuestion); browser.Type(MobileLobbyControls.securityAnswer, securityAnswer); MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.contactMe, "on"); MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.aggreement, "on"); Thread.Sleep(1000); return username; } catch (Exception ex) { CaptureScreenshot(browser, "EnterRegisterDetails"); Console.WriteLine("Function 'EnterRegisterDetails' - Failed"); Console.WriteLine(ex.Message); Fail(ex.Message); return null; } }
/// <summary> /// Restricting the customer for placing bets /// </summary> /// Author : Hemalatha /// Date Created : 11-07-2012 /// Pre-conditions : User should logged into the admin /// <param name="adminBrowser">browser instance</param> /// <param name="custName">Customer Name</param> /// <param name="reasonDesc">Reason for restricting the customer</param> /// <returns></returns> public bool AddCustFlag(ISelenium adminBrowser, string custName, string reasonDesc, string flagName) { try { if (AdminSearchCustomer(adminBrowser, custName) == true) { //Click on the Amend Status Flag Button if (!AdminTableObjects(adminBrowser, "Customer attributes", "", "Button", "Amend Status Flags", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to click on the Amend Status Flags button in Customer detail page"); return false; } //select Customer Status Flag if (!AdminTableObjects(adminBrowser, "Add Customer Status Flag", "Customer Status Flag", "Select Box", flagName, 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to click on the Customer Status Flags button in Customer detail page"); return false; } //Entering reason for adding the flag string reason = "//table[contains(string(),'Add Customer Status Flag')]//tr[contains(string(),'Reason Description')]/td/textarea[@name='reason']"; adminBrowser.Highlight(reason); adminBrowser.Type(reason, reasonDesc); //Clicking the Add Status Flag button string statusFlagButton = "//input[@value='Add Status Flag']"; adminBrowser.Click(statusFlagButton); } Console.WriteLine("Successfully restricted the customer for bets"); return true; } catch (Exception e) { Console.WriteLine(e.Message); Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); return false; } }
/// <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> /// To update the Selection /// </summary> /// <param name="browser">Selenium browser Instance</param> /// <param name="selectionId">ID of the selection</param> /// <param name="status"> Display Status to be updated</param> public void UpdateSelectionDisplayStatus(ISelenium browser, string selectionId, string displayStatus) { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionId); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); if (String.IsNullOrWhiteSpace(displayStatus) == false) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.SelectionDispStatusListBx, "label=" + displayStatus + ""); } else { Fail("unable to update the Displayed status in admin as Displayed list box is not present in admin"); } // Updating the event details page browser.Click(AdminSuite.CommonControls.EventDetailsPage.SelectionUpdateBtn); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); }
/// <summary> /// Verifying selection data /// </summary> /// <param name="browser">Browser instance</param> /// <param name="testData">TestData</param> public void VerifySelectionData(ISelenium browser, TestData testData) { string selectionStatus = string.Empty; string selectionDisplay = string.Empty; string selectionPrice = string.Empty; bool updateSelectionFlg = false; if (_frameworkCommon.WaitUntilElementPresent(browser, "name=OcDesc", "60") == true) { selectionStatus = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.SelectionStatusLstBx); selectionDisplay = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.SelectionDispStatusListBx); selectionPrice = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.PriceTxtBx); if ("a" != selectionStatus.ToLower()) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.SelectionStatusLstBx, "label=Active"); Console.WriteLine("Updated selection status to Active"); updateSelectionFlg = true; } if ("y" != selectionDisplay.ToLower()) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.SelectionDispStatusListBx, "label=Yes"); Console.WriteLine("Updated selection display to Yes"); updateSelectionFlg = true; } if (testData.Odds != selectionPrice) { browser.Type(AdminSuite.CommonControls.EventDetailsPage.PriceTxtBx, testData.Odds); Console.WriteLine("Updated selection price from test data"); updateSelectionFlg = true; } if (updateSelectionFlg) { if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.SelectionUpdateBtn)) { browser.Click(AdminSuite.CommonControls.EventDetailsPage.SelectionUpdateBtn); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); } else { Console.WriteLine("Unable to update the event in Openbet"); } Thread.Sleep(3000); } browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } }
/// <summary> Update the Handicap Value of a selection /// Author : Yogesh M /// </summary> /// Date Created: Feb 03 2012 /// eg: updatehandicapValue = UpdateHandicapValue(browser, "1234555", "2"); /// Note: You need to specify the list number present in the Handicap list box & not the value in the list box /// <param name="browser">Selenium Browser Instance</param> /// <param name="selectionId">Selection Id of the selection</param> /// <param name="handicapListNumber">The list number in the handicap list box(1 to 81)</param> /// <returns> Updated handicap value</returns> public string UpdateHandicapValue(ISelenium browser, string selectionId, int handicapListNumber) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame Thread.Sleep(2000); browser.WaitForPageToLoad("60000"); browser.SelectFrame("relative=top"); browser.SelectFrame("MainArea"); browser.WaitForPageToLoad("10000"); //SelectMainFrame(browser); browser.Type("//input[@name='openbet_id']", selectionId); // browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Select("//select[@name='hierarchy_level']", AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Focus(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); browser.Focus(AdminSuite.CommonControls.EventDetailsPage.BackButton); //click on back button present in the selection page browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton); //click on back button present in the selection page browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); //update the handicap value in the market page IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver; _frameworkCommon.WaitUntilAllElementsLoad(browser); Thread.Sleep(5000); _frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.HandicapValueListBox, "20000"); int labels = driver.FindElements(By.XPath(AdminSuite.CommonControls.EventDetailsPage.HandicaValueLabels)).Count; // verify if the user has entered the handicap list number present in the handicap list box in market page Assert.IsTrue(handicapListNumber <= labels, "Please select a handicap list number <= " + labels + ""); string updatedHandicapValue = driver.FindElement(By.XPath("//select[@name='MktHcapValue']/option[" + handicapListNumber + "]")).Text; browser.Select(AdminSuite.CommonControls.EventDetailsPage.HandicapValueListBox, updatedHandicapValue); // Handicap list drop down in the market page // Updating the event details page browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); Console.WriteLine("Handicapped value is updated to : " + updatedHandicapValue + ""); return updatedHandicapValue; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Message); return null; } }
public void UpdateHorseRaceSelectionResultSettlement(ISelenium browser, string selectionID, string resultValue) { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionID); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); //browser.SelectFrame("MainArea"); if (String.IsNullOrWhiteSpace(resultValue) == false) { browser.Select("name=OcResult", "label=" + resultValue + ""); } // Updating the event details page browser.Click("//th/input[@value='Set Selection Results']"); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); //th/input[@value='Set Selection Results'] }
/// <Summary> /// Update Horse Racing event start date to tomorrow's date /// Author: Aswathy /// Created Date: Apr-19-2013 /// </Summary> /* public void UpdateEventStartDate(ISelenium adminBrowser, string eventID, DateTime date) { string x = date.ToString("yyyy-MM-dd hh:mm:ss"); //Eg:2013-04-29 15:00:00 //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, adminBrowser); //Selecting TopFrame SelectMainFrame(adminBrowser); adminBrowser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, eventID); adminBrowser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyLevelEvent); adminBrowser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); adminBrowser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); adminBrowser.Type("//input[@id='start_time']", date.ToString()); adminBrowser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } */ /// <Summary> /// Update Horse Racing event start date to tomorrow's date /// Author: Aswathy /// Created Date: Apr-26-2013 /// </Summary> /// public void UpdateOdds(ISelenium adminBrowser, string eventID, string newOddVal) { // Click on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, adminBrowser); SelectMainFrame(adminBrowser); adminBrowser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, eventID); adminBrowser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); adminBrowser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); adminBrowser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); // Updating the price adminBrowser.Type(AdminSuite.CommonControls.EventDetailsPage.PriceTxtBx, newOddVal); adminBrowser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifySelectionButton); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); }
/// <summary> Update the Market Index Value of a selection dynamically, also we can suspend the market /// Author : Yogesh M /// Date Created: Feb 05 2011 /// Date Modfied: March 06 2011 /// Modification Comments: Added the status of market in the method /// Note: Market Index value is <= number of selections the market has /// eg: updatedMarketIndexValue = UpdateMarketIndex(browser, selectionId, 2, Suspended); /// UpdateMarketIndex(browser, selectionId, 0, Active); //label=Suspended or label=Active /// <param name="browser">Selenium Browser instance</param> /// </summary> /// <param name="browser"> </param> /// <param name="selectionId">Selection Id of the selection</param> /// <param name="updatedMarketIndexValue">User entered value of updated market index</param> /// <param name="status"> </param> /// <returns>Updated Market Index value</returns> public string UpdateMarketIndex(ISelenium browser, string selectionId, int updatedMarketIndexValue, string status) { try { string updatedMarektIndex = ""; //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.WaitForFrameToLoad(AdminSuite.CommonControls.AdminHomePage.EventNameLink, FrameGlobals.PageLoadTimeOut); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionId); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton);//click on back button present in the selection page browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); if (updatedMarketIndexValue != 0) { //update the marketIndex value in the market page updatedMarektIndex = Convert.ToString(updatedMarketIndexValue, CultureInfo.InvariantCulture); browser.Type(AdminSuite.CommonControls.EventDetailsPage.BirIndexTextBox, updatedMarektIndex); Console.WriteLine("Market index is updated to : " + updatedMarektIndex + ""); //return updatedMarektIndex; } if (String.IsNullOrWhiteSpace(status) == false) { browser.Select("name=MktStatus", "label=" + status + ""); } // Updating the event details page browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); return updatedMarektIndex; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Message); return null; } }
/// <summary> /// Update market by Market id in Open bet /// </summary> /// <param name="browser">Browser instance</param> /// <param name="marketId">Market id</param> /// <param name="marketStatus">Market status</param> /// <param name="marketDisplayed">Display</param> public void UpdateMarketByMarketID(ISelenium browser, string marketId, string marketStatus, string marketDisplayed) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.WaitForFrameToLoad(AdminSuite.CommonControls.AdminHomePage.EventNameLink, FrameGlobals.PageLoadTimeOut); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, marketId); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, "label=Event market");// AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); //browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton);//click on back button present in the selection page //browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); if (string.Empty != marketStatus) { if (marketStatus == "Suspend") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Suspended"); } else if (marketStatus == "Active") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Active"); } else { throw new AutomationException("Market status is invalid."); } browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } if (string.Empty != marketDisplayed) { if (marketDisplayed == "Yes") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.mktDisplayListBox, "label=Yes"); } else if (marketDisplayed == "No") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.mktDisplayListBox, "label=No"); } else { throw new AutomationException("Market displayed is invalid."); } } //update Market if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton)) { browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "Market Updation is not Successfull"); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Message); //return null; } }
public void UpdateEventStartDateTimeBySelectionID(ISelenium browser, string selectionID, string startDateTime) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.WaitForFrameToLoad(AdminSuite.CommonControls.AdminHomePage.EventNameLink, FrameGlobals.PageLoadTimeOut); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionID); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, "label=Even outcome");// AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton);//click on back button present in the selection page browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton);//click on back button present in the selection page browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); string startTimeXpath = "//input[@name='EvStartTime']"; browser.Type(startTimeXpath, startDateTime); //if (browser.IsElementPresent(startTimeXpath)) //{ // //startTime = browser.GetText(startTimeXpath); // startTime = browser.GetValue(startTimeXpath); //} //Updating the Event if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn)) { browser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "Event Updation is not Successfull"); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Message); //return null; } }
/// <summary> /// To update the Selection /// </summary> /// <param name="browser">Selenium browser Instance</param> /// <param name="selectionId">ID of the selection</param> /// <param name="price">Price tobe updated</param> /// <param name="status"> Status tobe updated</param> /// Ex: Pass Argument as "Active" public void UpdateSelection(ISelenium browser, string selectionId, string price, string status, string multipleKeyVal, string displayed) { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionId); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); if (String.IsNullOrWhiteSpace(status) == false) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.SelectionStatusLstBx, "label=" + status + ""); } if (String.IsNullOrWhiteSpace(price) == false) { browser.Type(AdminSuite.CommonControls.EventDetailsPage.PriceTxtBx, price); } // Adding multiplekeyvalue for the selection if (multipleKeyVal != "") { browser.Type(AdminSuite.CommonControls.EventDetailsPage.multipleKeyTxtBx, multipleKeyVal); } if (displayed != string.Empty) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.SelectionDispStatusListBx, "label=" + displayed + ""); } // Updating the event details page browser.Click(AdminSuite.CommonControls.EventDetailsPage.SelectionUpdateBtn); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); }