Пример #1
0
 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')]"));
 }
Пример #2
0
 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"));
 }
Пример #3
0
        ///<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");
            }
        }
        ///<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);
            }
        }
Пример #5
0
        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']");
        }
Пример #6
0
        public void LoginWithOpenIdSuccess()
        {
            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);

            var guid = Guid.NewGuid();
            var name = guid.ToString().Replace('-', '_').Substring(0, 12);

            selenium.Click("//a[contains(@href, '/User/Index')]");
            selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait);
            selenium.Click("//a[contains(@href, '/User/Create')]");
            selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait);
            selenium.Type("id=Username", "nestor");
            selenium.Type("id=Password", "1");
            selenium.Type("id=Email", "*****@*****.**");
            selenium.Type("id=Name", "nestor");
            selenium.Type("id=UserId", "id_nestor");
            selenium.Type("id=OpenId", "yavora.livejournal.com");
            selenium.Click("//input[@value='Create']");
            selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait);
            selenium.Click("//a[contains(@href, '/Account/Logout')]");
            selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait);

            selenium.Type("id=loginIdentifier", "yavora.livejournal.com");
            selenium.Click("//div[@id='logindisplay']/form[1]/input[2]");
            selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait);

            if (!selenium.IsElementPresent("//a[contains(@href, '/Account/Index')]"))
            {
                selenium.Type("id=login_user", "yavora");
                selenium.Type("id=login_password", "nestor1");
                selenium.Click("//input[@id='loginlj_submit']");
                selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait);
                if (selenium.GetLocation().Contains("http://www.livejournal.com"))
                {
                    selenium.Click("//input[@name='yes:once']");
                    selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait);
                }
            }

            Assert.IsTrue(selenium.IsElementPresent("//a[contains(@href, '/Account/Index')]"));
        }
Пример #7
0
 public void UploadNewAvatar()
 {
     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=Account");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("link=Edit");
     selenium.WaitForPageToLoad("30000");
     selenium.Type("file", "D:\\IUDICO\\Iudico Code\\IUDICO.LMS\\Data\\Avatars\\test.png");
     selenium.Click("//input[@value='Upload']");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("link=Back to Account");
     selenium.WaitForPageToLoad("30000");
     Assert.IsTrue(selenium.IsElementPresent("avatar"));
 }
Пример #8
0
 public void LoginAsAdmin()
 {
     selenium.Open("/");
     selenium.Type("//input[@id='loginUsername']", "lex");
     selenium.Type("//input[@id='loginPassword']", "lex");
     selenium.Click("//div[@id='logindisplay']/form[2]/input[3]");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("//a[contains(@href, '/Account/Index')]");
     selenium.WaitForPageToLoad("30000");
     Assert.IsFalse(selenium.IsElementPresent("//a[contains(@href, '/Account/TeacherToAdminUpgrade')]"));
 }
        ///<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);
            }
        }
Пример #10
0
        public void CreateCourseTest()
        {
            selenium.WaitForPageToLoad("40000");
            selenium.Click("link=Create New");
            selenium.WaitForPageToLoad("40000");
            selenium.Type("id=Name", "Test");
            selenium.Click("css=input[value=\"Create\"]");
            selenium.WaitForPageToLoad("40000");

            bool isPresent = selenium.IsElementPresent("//table[@id='myCourses']//tr//td[contains(.,'Test')]");

            Assert.IsTrue(isPresent);
        }
Пример #11
0
 public void LogoutSuccess()
 {
     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/Logout')]");
     selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait);
     Assert.IsFalse(selenium.IsElementPresent("//a[contains(@href, '/Account/Index')]"));
 }
Пример #12
0
 // Wait for Element present. Time out is 30s.
 public static void WaitforElementPresent(string sElement,ISelenium selenium)
 {
     for (int i = 0; i < 100; i++)
     {
         if (selenium.IsElementPresent(sElement))
         {
             break;
         }
         Thread.Sleep(50);
     }
 }
Пример #13
0
 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"));
 }
Пример #14
0
 public void LoginAsAdmin()
 {
     selenium.Open("/");
     selenium.Type("//input[@id='loginUsername']", "lex");
     selenium.Type("//input[@id='loginPassword']", "lex");
     selenium.Click("//div[@id='logindisplay']/form[2]/input[3]");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("link=" + IUDICO.UserManagement.Localization.getMessage("Account"));
     selenium.WaitForPageToLoad("30000");
     Assert.IsTrue(selenium.IsElementPresent("link=" + IUDICO.UserManagement.Localization.getMessage("UpgradeToAdmin")) == false);
 }
Пример #15
0
        /// <summary>
        /// Get Desired element attribute.
        /// Eg. GetElementAttribute(browserInstance, "//div[@id='myFavourites']", "title")
        /// </summary>
        /// <param name="browser">Browser Instance</param>
        /// <param name="xPath">Element xpath</param>
        /// <param name="attributeName">Attribute Name</param>
        /// <returns>Returns attirbute value</returns>
        public string GetElementAttribute(ISelenium browser, string xPath, string attributeName)
        {
            string attributeValue = string.Empty;

            IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;

            if (browser.IsElementPresent(xPath))
            {
                attributeValue = driver.FindElement(By.XPath(xPath)).GetAttribute(attributeName);
            }
            else
            {
                throw new AutomationException("Element " + xPath + " is not found");
            }
            return(attributeValue);
        }
Пример #16
0
        public bool WaitUntilElementPresent(ISelenium myBrowser, string locator, string timeout)
        {
            DateTime endTime = DateTime.Now.AddMilliseconds(Convert.ToDouble(timeout, CultureInfo.CurrentCulture));

            while (endTime > DateTime.Now)
            {
                if (myBrowser.IsElementPresent(locator))
                {
                    return(true);
                }
                else
                {
                    Thread.Sleep(Convert.ToInt32(Convert.ToDouble(timeout, CultureInfo.InvariantCulture) / 10.0, CultureInfo.InvariantCulture));
                }
            }
            throw new AutomationException("Element with search critera '" + locator + "' was not found.");
        }
Пример #17
0
        /// <summary>
        /// Method to check whether Toggle Button(CheckBox/Radio) is checked or not
        /// </summary>
        /// Authour: Vamsi krishna Boyapati
        /// <param name="objMySelenium">Selenium RC Instance</param>
        /// <param name="strLocator">Locator of the Control/Element(Xpath)</param>
        /// <returns>Boolean value(True/False)</returns>

        public bool GetCheckBoxStatus(ISelenium objMySelenium, string strLocator)
        {
            bool bStatus = false;

            try
            {
                if (objMySelenium.IsElementPresent(strLocator))
                {
                    bStatus = objMySelenium.IsChecked(strLocator);
                }
            }
            catch (AutomationException EX)
            {
                Console.WriteLine(EX.Message);
            }
            return(bStatus);
        }
Пример #18
0
        public bool WaitUntilElementPresentAndReturnTrue(ISelenium myBrowser, string locator, string timeout)
        {
            DateTime endTime = DateTime.Now.AddMilliseconds(Convert.ToDouble(timeout, CultureInfo.CurrentCulture));

            while (endTime > DateTime.Now)
            {
                if (myBrowser.IsElementPresent(locator))
                {
                    return(true);
                }
                else
                {
                    Thread.Sleep(Convert.ToInt32(Convert.ToDouble(timeout, CultureInfo.InvariantCulture) / 10.0,
                                                 CultureInfo.InvariantCulture));
                }
            }
            return(false);
        }
Пример #19
0
        /// <summary>
        /// Method to Check the Radio Button
        /// </summary>
        /// Authour: Vamsi krishna Boyapati
        /// <param name="objMySelenium">Selenium RC Instance</param>
        /// <param name="strLocator">Locator of the Control/Element(Xpath)</param>
        /// <returns>Boolean value(True/False)</returns>
        public bool SelectRadioButton(ISelenium objMySelenium, string strLocator)
        {
            bool bStatus = false;

            try
            {
                if (objMySelenium.IsElementPresent(strLocator))
                {
                    objMySelenium.Check(strLocator);
                    bStatus = true;
                }
            }
            catch (AutomationException EX)
            {
                Console.WriteLine(EX.Message);
            }
            return(bStatus);
        }
Пример #20
0
        public static bool IsPresentInLessThan(this ISelenium sel, int seconds, IBase iBase)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            while (stopwatch.Elapsed.Seconds < seconds)
            {
                bool present = sel.IsElementPresent(iBase.ToXPathExpression());
                if (present == true)
                {
                    return(true);
                }
                //sleep for 200 ms between checks
                Thread.Sleep(200);
            }

            return(false);
        }
Пример #21
0
        public void ViewAndPayOrder()
        {
            selenium.Click("ctl00_navigation_menu_NavigationControl_NavTreeViewt1");
            selenium.WaitForPageToLoad("5000");

            Order order   = orderRepo.Orders.Single(o => o.job_name.Contains("Salsa Impulse"));
            int   orderId = order.orderID;

            Assert.IsTrue(selenium.IsTextPresent("Salsa Impulse"));
            Assert.IsTrue(selenium.IsElementPresent("ctl00_body_content_" + orderId + "s"));

            selenium.Click("ctl00_body_content_" + orderId + "s");
            Thread.Sleep(2000);

            ((Table <Order>)orderRepo.Orders).Context.Refresh(RefreshMode.OverwriteCurrentValues, order);
            Assert.AreEqual(2, order.currentStatus);

            Assert.IsTrue(selenium.IsTextPresent("Paid"));
        }
Пример #22
0
        // 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");

        }
        /// <summary>
        /// Method to update and validate event display status validation
        /// </summary>
        public void EventDisplayStatusValidation(ISelenium browser, ISelenium adminBrowser, TestData testData, string navPanel,string eventName)
        {
            try
            {
                #region Event Display Status Validation

                adminCommonObj.UpdateEventsDisplaySts(adminBrowser, testData.CategoryName, testData.ClassName, testData.TypeName, testData.SubTypeName, testData.EventName, "No");
                Thread.Sleep(FrameGlobals.OpenBetReflectTimeOut);
                Console.WriteLine("Event Display status is updated in admin");

                btCommonObj.NavigateToSportsPage(browser, testData.ClassName, navPanel, testData.ClassName);

                Assert.IsFalse(browser.IsElementPresent("//li/a/div[contains(text(), '" + eventName + "')]/following-sibling::div[contains(text(), '" + testData.TypeName + "')]/following-sibling::div[@class='bxcl mr5 arrow next-arrow']"),
                                                                        "Event is still displayed after update");
                #endregion
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                CaptureScreenshot(browser, "EventDisplayStatusValidation");
            }
        }
Пример #24
0
        public void TC001_VerifyDatainCountryLivingSite()
        {
            string error = "";

            try
            {
                OpenNewBrowser();
                //check menu decorating & home improvement
                _selenium.IsElementPresent("//div[@id='m_cat_tn2']/a/img");
                _selenium.Click("//div[@id='m_cat_tn2']/a/img");

                Thread.Sleep(5000);
                Assert.IsTrue(_selenium.IsTextPresent("More Decorating and Home Improvement Articles"));
            }
            catch (AssertionException e)
            {
                error = e.ToString();
                Console.WriteLine("Test case T001 failed" + error);
                Console.WriteLine("---------------------------------------------------------------------------------------");
            }
            Assert.AreEqual("", error);
        }
Пример #25
0
        public bool WaitUntilElementOrWindowsAlertPresent(ISelenium myBrowser, string locator, string windowTitle, string dialogName, string timeout)
        {
            var      windowPopupHandler = new Framework.Common.WindowPopupHandler();
            DateTime endTime            = DateTime.Now.AddMilliseconds(Convert.ToDouble(timeout, CultureInfo.CurrentCulture));

            while (endTime > DateTime.Now)
            {
                if (myBrowser.IsElementPresent(locator))
                {
                    return(true);
                }
                else if (windowPopupHandler.IsAlertDialogPresent(windowTitle, dialogName))
                {
                    return(false);
                }
                else
                {
                    Thread.Sleep(Convert.ToInt32(Convert.ToDouble(timeout, CultureInfo.InvariantCulture) / 10.0, CultureInfo.InvariantCulture));
                }
            }

            throw new AutomationException("Element was not found.");
        }
Пример #26
0
        /// <summary>
        /// Method to Wait until Either Desired/Specific element is present or specified time is elapsed
        /// </summary>
        /// Authour: Vamsi krishna Boyapati
        /// Date:26th-March-2013
        /// <param name="objMySelenium">Selenium RC Instance</param>
        /// <param name="strLocator">Locator of the Control/Element(Xpath)</param>
        /// <param name="varTimeOut">Time to Wait</param>

        public void WiatForElementToPresent(ISelenium objMySelenium, string strLocator, int varTimeOut)
        {
            try
            {
                DateTime varDateTime;
                DateTime varElapseTime = DateTime.Now.AddSeconds(varTimeOut);
                do
                {
                    varDateTime = DateTime.Now;
                    if (objMySelenium.IsElementPresent(strLocator))
                    {
                        break;
                    }
                    else
                    {
                        Thread.Sleep(2000);
                    }
                } while (varDateTime <= varElapseTime);
            }
            catch (AutomationException EX)
            {
                Console.WriteLine(EX.Message);
            }
        }
Пример #27
0
        /// <summary>
        /// Adding a Reward Adhoc token to customer in Admin.
        /// </summary>
        /// Date Created:
        /// Author: Anand C
        /// User should be login to Admin application
        /// <param name="adminBrowser">Browser Instance</param>
        /// <param name="custName">Customer name for whom the token be added</param>
        /// <param name="tokenVal">token value to be added</param>
        public bool AgeVerification(ISelenium adminBrowser, string cardNum, string issueNum, string CustomerName)
        {
            try
            {
                Framework.Common.Common FrameWKCommon = new Framework.Common.Common();
                //Click on Customer Verification button
                if (!AdminTableObjects(adminBrowser, "Customer attributes", "", "Button", "Customer Verification", 1))
                {
                    Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
                    Console.WriteLine("Unable to click on Customer Verification button in Customer attributes table");
                    return false;
                }

                Assert.IsTrue(adminBrowser.IsElementPresent(AdminSuite.CommonControls.AdminHomePage.custVerifyCountry), "Unable to find country select box in customer verify page");
                Assert.IsTrue(adminBrowser.IsElementPresent("//input[@type='radio' and @value = 'A']"), "Unable to find country select box in customer verify page");

                adminBrowser.Click("//input[@type='radio' and @value = 'A']");

                //Entering value in OVS Score: Text box in Customer verification page
                if (!AdminTableObjects(adminBrowser, "Manually Verify Customer", "OVS Score", "Text Box", "100", 1))
                {
                    Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
                    Console.WriteLine("Unable to put value in OVS Score Text box in Manually Verify Customer page");
                    return false;
                }

                //Entering value in Reference: Text box in Customer verification page
                if (!AdminTableObjects(adminBrowser, "Manually Verify Customer", "Reference", "Text Box", "100", 1))
                {
                    Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
                    Console.WriteLine("Unable to put value in Reference Text box in Manually Verify Customer page");
                    return false;
                }

                //Entering value in Notes Text box in Customer verification page
                if (!AdminTableObjects(adminBrowser, "Manually Verify Customer", "Notes", "Text Box", "Notes", 1))
                {
                    Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
                    Console.WriteLine("Unable to put value in Notes Text box in Manually Verify Customer page");
                    return false;
                }

                Assert.IsTrue(adminBrowser.IsElementPresent("//input[@type='radio' and @value = 'A']"), "Unable to find country select box in customer verify page");
                adminBrowser.Click("//input[@type='radio' and @value = 'A']");

                //Entering value in Driving Licence No Text box in Customer verification page
                if (!AdminTableObjects(adminBrowser, "Manually Verify Customer", "Driving Licence No", "Text Box", "Notes", 1))
                {
                    Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
                    Console.WriteLine("Unable to put value in Driving Licence No Text box in Manually Verify Customer page");
                    return false;
                }

                //Click on Add Payment Method button
                if (!AdminTableObjects(adminBrowser, "Add payment method", "", "Button", "Add Payment Method", 1))
                {
                    Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
                    Console.WriteLine("Unable click on Add Payment Method button in New Payment Method page");
                    return false;
                }

                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                Thread.Sleep(5000);
                Console.WriteLine("Successfully added payment method for customer");
                return true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
                return false;
            }
        }
Пример #28
0
        /// <summary>
        /// To logout from Admin
        /// </summary>
        ///  Author: Anand
        /// <param name="myBrowser"> </param>
        /// Created Date: 12-April-2012
        public void AdminLogout(ISelenium myBrowser)
        {
            try
            {
                // Navigating to LHN
                SelectTopBarFrame(myBrowser);
                IWebDriver driver = ((WebDriverBackedSelenium)myBrowser).UnderlyingWebDriver;
                //Assert.IsTrue(myBrowser.IsElementPresent("//a[contains(text(),'Logout')]"),"logout link"

                if (myBrowser.IsElementPresent("//a[contains(text(),'Logout')]"))
                {
                    myBrowser.Click("//a[contains(text(),'Logout')]");
                    myBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                }
                else
                {
                    ConsoleColor clr = new ConsoleColor();
                    clr = Console.ForegroundColor;
                    Console.ForegroundColor = ConsoleColor.DarkRed;
                    Console.WriteLine("!!!Warning: Logout link not present in LHN of Admin");
                    Console.ForegroundColor = clr;
                }

            }
            catch (Exception ex)
            {
                BaseTest.CaptureScreenshot(myBrowser, "");
                Console.WriteLine(ex.StackTrace);
                BaseTest.Fail(ex.Message);
            }
        }
Пример #29
0
 /// <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;
     }
 }
Пример #30
0
 /// <summary>
 /// Checks whether the element exists or not
 /// </summary>
 /// <param name="locator">The locator.</param>
 /// <returns>True if the element present else false</returns>
 public bool IsElementExists(string locator)
 {
     return(_selenium.IsElementPresent(locator));
 }
Пример #31
0
        /// <summary>
        /// Search for an Event
        /// </summary>
        /// <param name="browser">Selenium browser instance</param>
        /// <param name="catName">Category Name</param>
        /// <param name="eventClsName">Event ClassName</param>
        /// <param name="eventTypeName">Event TypeName</param>
        /// <param name="eventSubType">Event SubType</param>
        /// <param name="eventName">Event Name</param>
        /// <param name="eventStatus">Event Status</param>
        public bool SearchEvent(ISelenium browser, string catName, string eventClsName, string eventTypeName, string eventSubType, string eventName)
        {
            try
            {
                bool eventFound = false;

                TimeSpan ts = new TimeSpan(0, 1, 0);
                IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;

                //Clicking on Event Link in LHN
                LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser);
                //Selecting TopFrame
                System.Threading.Thread.Sleep(10000);
                SelectMainFrame(browser);

                _frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "60");
                catName = catName.Replace("|", "").Trim();
                if (catName != "")
                {
                    if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx))
                    {
                        Assert.IsTrue(_frameworkCommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, catName), "Category Name does not present in DropdownList");
                        browser.Select(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "label=" + catName);
                    }
                }
                eventClsName = eventClsName.Replace("|", "").Trim();

                if (eventClsName != "")
                {
                    if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx))
                    {
                        Assert.IsTrue(_frameworkCommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, eventClsName), "EventClass Name does not present");
                        browser.Select(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, "label=" + eventClsName);
                    }
                }
                if (eventTypeName != "")
                {
                    if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx))
                    {
                        Assert.IsTrue(_frameworkCommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, eventTypeName), "EventClass Name does not present");
                        browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, "label=" + eventTypeName);
                    }
                }
                if (eventSubType != "")
                {
                    if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx))
                    {
                        Assert.IsTrue(_frameworkCommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx, eventSubType), "EventSubType Name does not present");
                        browser.Select(AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx, "label=" + eventSubType);
                    }
                }
                Assert.IsTrue(_frameworkCommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "--"), "Date range dropdown missing");

                // Selecting Daterange
                if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx))
                {
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "label=--");
                }
                //Clicking on Seach button
                browser.Click(AdminSuite.CommonControls.EventDetailsPage.eventSearchBtn);
                _frameworkCommon.WaitUntilAllElementsLoad(browser);
                browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                //Thread.Sleep(2000);
                // Wait for Element to present

                if (_frameworkCommon.WaitUntilElementPresent(browser, "link=" + eventName + "", "60") == true)
                {
                    browser.Click("link=" + eventName);
                    browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                    eventFound = true;
                }
                return eventFound;
            }

            catch (Exception ex)
            {
                CaptureScreenshot(browser, "");
                Fail(ex.Message);
                return false;
            }
        }
        ///<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;
            }
        }
Пример #33
0
        /// <summary>
        /// To Update Markt  Status
        /// </summary>
        /// <param name="browser">Selenium browser instance</param>
        /// <param name="catName">Category Name</param>
        /// <param name="eventClsName">Event ClassName</param>
        /// <param name="eventTypeName">Event TypeName</param>
        /// <param name="eventSubType">Event SubType</param>
        /// <param name="eventName">Event Name</param>
        /// <param name="eventStatus">Event Display Status</param>
        public void UpdateMarketStatus(ISelenium browser, string catName, string eventClsName, string eventTypeName, string eventSubType, string eventName, string mktName, string marketStatus)
        {
            string errorMessage = "";
            bool eventUpdationStatus = false;
            bool finalEventStatus = true;
            Framework.Common.Common frameworkcommon = new Framework.Common.Common();
            AdminSuite.Common com = new AdminSuite.Common();
            Framework.Common.Common Fcommon = new Framework.Common.Common();

            TimeSpan ts = new TimeSpan(0, 1, 0);
            IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;

            //Clicking on Event Link in LHN
            LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser);
            //Selecting TopFrame
            SelectMainFrame(browser);
            System.Threading.Thread.Sleep(10000);

            frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "60");
            catName = catName.Replace("|", "").Trim();
            if (catName != "")
            {
                Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, catName), "Category Name does not present in DropdownList");
                browser.Select(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "label=" + catName);
            }
            eventClsName = eventClsName.Replace("|", "").Trim();

            if (eventClsName != "")
            {
                Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, eventClsName), "EventClass Name does not present");
                browser.Select(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, "label=" + eventClsName);
            }
            if (eventTypeName != "")
            {
                Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, eventTypeName), "EventClass Name does not present");
                browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, "label=" + eventTypeName);
            }
            Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "--"), "Date range dropdown missing");

            // Selecting Daterange
            browser.Select(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "label=--");

            //Clicking on Seach button
            browser.Click(AdminSuite.CommonControls.EventDetailsPage.eventSearchBtn);
            _frameworkCommon.WaitUntilAllElementsLoad(browser);
            browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);

            // Wait for Element to present
            if (frameworkcommon.WaitUntilElementPresent(browser, "link=" + eventName + "", "60") == true)
            {
                browser.Click("link=" + eventName);
                browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                Thread.Sleep(10000);
                //Wait Untill the EventDetails Page loads
                if (frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "60") == true)
                {

                    if (frameworkcommon.WaitUntilElementPresent(browser, "link=" + "|" + mktName + "|" + "", "60") == true)
                    {
                        //browser.Click("link=" + mktName);
                        browser.Click("link=" + "|" + mktName + "|");
                        browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);

                        if (marketStatus == "Suspend")
                        {
                            browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Suspended");
                            eventUpdationStatus = false;
                            browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                        }
                        else
                        {
                            browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Active");
                        }

                        //Updating the Event
                        if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton))
                        {
                            if (eventUpdationStatus == false)
                            {
                                browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton);
                                browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                                Assert.IsTrue(frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "markrt display status Updation is not Successfull");
                                browser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn);
                                browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                            }
                        }
                    }
                }
            }
            else
            {
                finalEventStatus = false;
                errorMessage = errorMessage + eventName;
                errorMessage = errorMessage + Environment.NewLine;
            }

            //Finally checking whether all the Events are Suspended or not
            if (finalEventStatus == false)
            {
                Framework.BaseTest.Fail("market display status updation Process is Failed");
            }
        }
Пример #34
0
        /// <summary>
        /// Adding a Reward Adhoc token to customer in Admin.
        /// </summary>
        /// Date Created:
        /// Author: Anand C
        /// User should be login to Admin application
        /// <param name="adminBrowser">Browser Instance</param>
        /// <param name="custName">Customer name for whom the token be added</param>
        /// <param name="tokenVal">token value to be added</param>
        public bool AdminDeleteFBlist(ISelenium adminBrowser, string custName)
        {
            try
            {
                IWebDriver driver = ((WebDriverBackedSelenium)adminBrowser).UnderlyingWebDriver;
                //Verifying freebet link in customer detail page
                adminBrowser.Highlight("//table//th/font[contains(text(),'Account information')]//ancestor::table//td[contains(text(),'Free bet tokens (open):')]/following-sibling::td/a");
                if (adminBrowser.IsElementPresent("//table//th/font[contains(text(),'Account information')]//ancestor::table//td[contains(text(),'Free bet tokens (open):')]/following-sibling::td/a"))
                {
                    adminBrowser.Click("//table//th/font[contains(text(),'Account information')]//ancestor::table//td[contains(text(),'Free bet tokens (open):')]/following-sibling::td/a");
                    adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                    ReadOnlyCollection<IWebElement> chkBoxs = driver.FindElements(By.XPath("//table//input[@type='checkbox']"));

                    //check all the check box
                    for (int chkBoxCount = 0; chkBoxCount < chkBoxs.Count; chkBoxCount++)
                    {
                        chkBoxs[chkBoxCount].Click();
                    }

                    //click on the Delete Token button
                    if (!AdminTableObjects(adminBrowser, "Free Token List", "", "Button", "Delete Token", 1))
                    {
                        Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
                        Console.WriteLine("Unable click on Find Customer button in Customer Search page");
                        return false;
                    }
                    Thread.Sleep(3000);
                    if (adminBrowser.IsElementPresent("//table//th[contains(string(),'Account information')]//ancestor::table//td[contains(text(),'" + "Free bet tokens (open):" + "')]/following-sibling::td/a"))
                    {
                        return false;
                    }
                }
                Console.WriteLine("Successfully deleted the FreeBets for customer");
                return true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
                return false;
            }
        }
Пример #35
0
        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;
            }
        }
Пример #36
0
        /// <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;
            }
        }
Пример #37
0
 /// <summary>
 /// Adding a Reward Adhoc token to customer in Admin.
 /// </summary>
 /// Date Created:
 /// Author: Anand C
 /// User should be login to Admin application
 /// <param name="adminBrowser">Browser Instance</param>
 /// <param name="custName">Customer name for whom the token be added</param>
 /// <param name="tokenVal">token value to be added</param>
 public bool addDebitCreditCard(ISelenium adminBrowser, string cardNum, string status, string CustomerName)
 {
     try
     {
         if (adminBrowser.IsElementPresent("//table//th[contains(text(),'Customer Payment Methods')]//ancestor::table/tbody/tr[td[contains(.,'" + cardNum.Substring(cardNum.Length - 4, 4) + "')]]//a"))
         {
             if (!UpdatePayMtd(adminBrowser, cardNum, "Active", CustomerName))
             {
                 Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
                 Console.WriteLine("Unable update the payment method");
                 return false;
             }
         }
         else
         {
             if (!addDebitCard(adminBrowser, cardNum, "", status, CustomerName))
             {
                 Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
                 Console.WriteLine("Unable to Add Payment method");
                 return false;
             }
         }
         Console.WriteLine("Successfully Added Payment method");
         return true;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
         return false;
     }
 }
Пример #38
0
        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;
            }
        }
Пример #39
0
        /// <summary>
        /// To suspend/ Activate the Events
        /// </summary>
        /// <param name="browser">Selenium browser instance</param>
        /// <param name="catName">Category Name</param>
        /// <param name="eventClsName">Event ClassName</param>
        /// <param name="eventTypeName">Event TypeName</param>
        /// <param name="eventSubType">Event SubType</param>
        /// <param name="eventName">Event Name</param>
        /// <param name="eventStatus">Event Status</param>
        public void UpdateEvents(ISelenium browser, string catName, string eventClsName, string eventTypeName, string eventSubType, string eventName, string eventStatus)
        {
            string errorMessage = "";
            bool eventUpdationStatus = false;
            bool finalEventStatus = true;
            Framework.Common.Common frameworkcommon = new Framework.Common.Common();
            AdminSuite.Common com = new AdminSuite.Common();
            Framework.Common.Common Fcommon = new Framework.Common.Common();

            TimeSpan ts = new TimeSpan(0, 1, 0);
            IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;

            //Clicking on Event Link in LHN
            LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser);
            //Selecting TopFrame
            System.Threading.Thread.Sleep(10000);
            SelectMainFrame(browser);

            frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "60");
            catName = catName.Replace("|", "").Trim();
            if (catName != "")
            {
                if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx))
                {
                    Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, catName), "Category Name does not present in DropdownList");
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "label=" + catName);
                }
            }
            eventClsName = eventClsName.Replace("|", "").Trim();

            if (eventClsName != "")
            {
                if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx))
                {
                    Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, eventClsName), "EventClass Name does not present");
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, "label=" + eventClsName);
                }
            }
            if (eventTypeName != "")
            {
                if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx))
                {
                    Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, eventTypeName), "EventClass Name does not present");
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, "label=" + eventTypeName);
                }
            }
            if (eventSubType != "")
            {
                if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx))
                {
                    Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx, eventSubType), "EventSubType Name does not present");
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx, "label=" + eventSubType);
                }
            }
            Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "--"), "Date range dropdown missing");

            // Selecting Daterange
            if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx))
            {
                browser.Select(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "label=--");
            }
            //Clicking on Seach button
            browser.Click(AdminSuite.CommonControls.EventDetailsPage.eventSearchBtn);
            _frameworkCommon.WaitUntilAllElementsLoad(browser);
            browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            //Thread.Sleep(2000);
            // Wait for Element to present

            if (frameworkcommon.WaitUntilElementPresent(browser, "link=" + eventName + "", "60") == true)
            {
                browser.Click("link=" + eventName);
                browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                if (eventStatus == "Taginfo" || eventStatus == "Taginfoundo")
                {
                    browser.Click("//a[contains(string(),'Race Winner')]");
                    Thread.Sleep(10000);
                    browser.Click("//tr[@class='active']//a[contains(string(),'Horse1')]");
                    Thread.Sleep(10000);
                    if (eventStatus == "Taginfoundo")
                        browser.Select("name=OcFlag", "label=Named runner");
                    else
                        browser.Select("name=OcFlag", "label=Unnamed favourite");

                    browser.Click("//input[@value='Modify Selection']");
                }
                else
                {
                    //Wait Untill the EventDetails Page loads
                    if (frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "60") == true)
                    {
                        if (eventStatus == "Suspend")
                        {
                            browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox, "label=Suspended");
                            eventUpdationStatus = false;
                            browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                        }
                        else
                        {
                            browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox, "label=Active");
                        }

                        //Updating the Event
                        if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn))
                        {
                            if (eventUpdationStatus == false)
                            {
                                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");
                            }

                        }
                    }
                }
            }

            else
            {
                finalEventStatus = false;
                errorMessage = errorMessage + eventName;
                errorMessage = errorMessage + Environment.NewLine;
            }

            //Finally checking whether all the Events are Suspended or not
            if (finalEventStatus == false)
            {
                Console.WriteLine("Following Events are not Suspended, Please verify Manually" + Environment.NewLine + errorMessage);
                Framework.BaseTest.Fail("Event suspending Process is Failed");
            }
        }
        ///<summary>
        /// This method registers a new customer
        /// <example>RegisterCustomer(browser) </example>
        public string RegisterCustomer(ISelenium browser, string promocode, string country, string accountCurrency, string DOByear)
        {
            try
            {
                IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;

                TimeSpan ts = new TimeSpan(0, 0, 5);
                driver.Manage().Timeouts().ImplicitlyWait(ts);
                Random rnd = new Random();
                int rndNumber = rnd.Next(10000);
                string regMsg, xPath;
                string[] fName = new string[] { "Dylan", "Ethan", "George", "Hary", "Jacob", "John" };
                string[] lName = new string[] { "Brown", "Jones", "Miller", "Roberts", "Taylor", "Wilson" };
                string firstname = "Auto" + fName[rnd.Next(0, 5)];
                string lastname = "Auto" + lName[rnd.Next(0, 5)];
                string username = "******" + rndNumber;
                EnterRegisterDetails(browser, promocode, country, accountCurrency, DOByear, firstname, lastname, username);

                //Validate registration
                clickObject_MobileLobby(browser, MobileLobbyControls.registerNow);

                // for banned country
                if (country.ToLower() == "united states")
                {
                    Assert.IsTrue(browser.IsVisible(MobileLobbyControls.failureRgMsg), "Registration failure message was not displayed");
                    Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration page title was not found in the header on registration status");
                    Assert.IsTrue(browser.IsVisible(MobileLobbyControls.Logo), "Ladbrokes Logo was not displayed on registration status");
                    Assert.IsTrue(browser.IsVisible(MobileLobbyControls.backbutton), "Back button was not displayed on registration status");

                    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 from a banned country");
                }
                // for below 18 years customers
                else if ((DateTime.Now.Year - int.Parse(DOByear)) < 18)
                {
                    Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration Page is not displayed");
                    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");
                    Console.WriteLine("Error message validated successfully for Customer of age below 18 attaempting to register");
                }
                // for regular customers
                else
                {
                    string balanceCurrXpath;
                    if (country.ToLower() == "united kingdom")
                    {
                        balanceCurrXpath = "//div[@class='samount' and contains(text(), 'Balance: £')]/span[@id='headerBalance' and contains(text(), '0.0')]";
                        regMsg = "Thanks " + firstname + ", your account has now been set up. Your customer ID is " + username + ". You have been sent an email with your details. To get going simply deposit a minimum of £ 5.00 and start betting.";
                    }
                    else
                    {
                        balanceCurrXpath = "//div[@class='samount' and contains(text(), 'Balance: $')]/span[@id='headerBalance' and contains(text(), '0.0')]";
                        regMsg = "Thanks " + firstname + ", your account has now been set up. Your customer ID is " + username + ". You have been sent an email with your details. To get going simply deposit a minimum of $ 5.00 and start betting.";
                    }
                    Assert.IsTrue(browser.IsVisible(MobileLobbyControls.successfulRgMsg), "Successful Registration message was not displayed, failed to register a new customer '" + username + "'");
                    Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration page title was not found in the header after registration");
                    Assert.IsTrue(browser.IsVisible(MobileLobbyControls.closebutton), "Done button was not displayed after registartion");
                    Assert.IsTrue(browser.IsVisible(balanceCurrXpath), "Balance header was not displayed after registartion");
                    Assert.IsTrue(browser.IsVisible(MobileLobbyControls.depositFunds), "Deposit funds button was not found after registartion");

                    xPath = "//div[@id='mainContent']/p[contains(text(), '" + regMsg + "')]";
                    Assert.IsTrue(browser.IsElementPresent(xPath), "Registrain messages was not displayed to the user");

                    Console.WriteLine("Customer '" + username + "' registered successfully");
                }
                return username;
            }
            catch (Exception ex)
            {
                CaptureScreenshot(browser, "RegisterCustomer");
                Console.WriteLine("Function 'RegisterCustomer' - Failed");
                Console.WriteLine(ex.Message);
                Fail(ex.Message);
                return null;
            }
        }
Пример #41
0
        /// <summary>
        /// Adding a Reward Adhoc token to customer in Admin.
        /// </summary>
        /// Date Created:
        /// Author: Anand C
        /// User should be login to Admin application
        /// <param name="adminBrowser">Browser Instance</param>
        /// <param name="custName">Customer name for whom the token be added</param>
        /// <param name="tokenVal">token value to be added</param>
        public bool UpdatePayMtd(ISelenium adminBrowser, string cardNum, string status, string CustomerName)
        {
            try
            {
                //Click on Debit/Credit link
                /*if (!AdminTableObjects(adminBrowser, "Customer Payment Methods", cardNum.Substring(cardNum.Length - 4, 4), "Link", "", 1))
                {
                    Framework.BaseTest.CaptureScreenshot(adminBrowser);
                    Console.WriteLine("Unable to put value in Card Search Text box in Card Search page");
                    return false;
                }*/
                Assert.IsTrue(adminBrowser.IsElementPresent("//table//th[contains(text(),'Customer Payment Methods')]//ancestor::table/tbody/tr[td[contains(.,'" + cardNum.Substring(cardNum.Length - 4, 4) + "')]]//a"), cardNum + " card is not available for this customer: " + CustomerName);
                adminBrowser.Click("//table//th[contains(text(),'Customer Payment Methods')]//ancestor::table/tbody/tr[td[contains(.,'" + cardNum.Substring(cardNum.Length - 4, 4) + "')]]//a");
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);

                //
                Assert.IsTrue(adminBrowser.IsElementPresent("//select[@name='status']"), "Authorisation status list box is not visible");
                Assert.IsTrue(adminBrowser.IsElementPresent("//select[@name='auth_dep']"), "Authorisation deposit list box is not visible");
                Assert.IsTrue(adminBrowser.IsElementPresent("//select[@name='auth_wtd']"), "Authorisation withdrawal list box is not visible");
                adminBrowser.Select("//select[@name='status']", status);
                adminBrowser.Select("//select[@name='auth_dep']", "Yes");
                adminBrowser.Select("//select[@name='status_dep']", "Active");
                adminBrowser.Select("//select[@name='auth_wtd']", "Yes");
                adminBrowser.Select("//select[@name='status_wtd']", "Active");

                //click on the Update Payment Method button
                if (!AdminTableObjects(adminBrowser, "Authorisation", "", "Button", "Update Payment Method", 1))
                {
                    Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
                    Console.WriteLine("Unable click on  Payment Method button in Customer Payment page");
                    return false;
                }
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                Thread.Sleep(5000);
                Console.WriteLine("Successfully searched the customer");
                return true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
                return false;
            }
        }
        ///<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);
            }
        }
Пример #43
0
        /// <summary>
        /// Updates a perticular segment value
        /// </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 UpdateSegments(ISelenium adminBrowser, string userName, string segmentType, string segmentVal)
        {
            try
            {
                // Enter Customer Name and Search
                SearchCustomer(userName, adminBrowser);
                SelectMainFrame(adminBrowser);
                adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.updateSegment);
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);

                string xPath = "//tr/td[contains(text(), '" + segmentType + "')]/following-sibling::td/select";
                Assert.IsTrue(adminBrowser.IsElementPresent(xPath), "Element not found " + xPath);
                adminBrowser.Select(xPath, segmentVal);
                Thread.Sleep(1000);
                adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.updateSegmentandURL);
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                xPath = "//tr/td[@class='caption' and contains(text(), '" + segmentType + "')]/following-sibling::td[contains(text(), '" + segmentVal + "')]";
                if (segmentVal.ToLower().Contains("unset") || segmentVal.ToLower().Contains("no"))
                {
                    if (adminBrowser.IsAlertPresent())
                    {
                        adminBrowser.ChooseOkOnNextConfirmation();
                    }
                    xPath = "//tr/td[@class='caption' and contains(text(), '" + segmentType + "')]/following-sibling::td/i[contains(text(), '" + segmentVal + "')]";
                }
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.backBtn);
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                Assert.IsTrue(adminBrowser.IsElementPresent(xPath), "Element not found " + xPath);
                return true;
            }
            catch (Exception ex)
            {
                CaptureScreenshot(adminBrowser, "");
                Fail(ex.Message);
                return false;
            }
        }
Пример #44
0
 /// <summary>
 /// Unlock the User which is locked
 /// </summary>
 ///  Author: Anand
 /// <param name="browser">browser Instance</param>
 /// <param name="userName">User Name</param>
 public void UnLockTheLockedUser(ISelenium browser, string userName)
 {
     decimal numberOfAciveRow;
     string amend = "//input[@value='Amend Status Flags']";
     // Enter Customer Name and Search
     SearchCustomer(userName, browser);
     // Click on Amend Status Flag
     browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
     SelectMainFrame(browser);
     if (browser.IsElementPresent(amend))
         browser.Click(amend);
     System.Threading.Thread.Sleep(5000);
     // Get Number of Active rows where user should be unlocked
     numberOfAciveRow = browser.GetXpathCount("//tbody/tr[@class='active']");
     if (numberOfAciveRow > 0)
     {
         for (int i = 0; i < numberOfAciveRow; i++)
         {
             browser.Click("link=[clear]");
             browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
             browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
             System.Threading.Thread.Sleep(5000);
             browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
         }
         Console.WriteLine("AdminSuite:Common:UnLockTheLockedUser-Pass: User " + userName + " Unlocked ");
     }
 }
Пример #45
0
        /// <summary>
        /// Verifying event details data in openbet
        /// </summary>
        /// <param name="browser">Browser instance</param>
        /// <param name="testData">Test data</param>
        public void VerifyEventData(ISelenium browser, TestData testData)
        {
            //IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;

            string eventStatus = string.Empty;
            string eventDisplay = string.Empty;
            bool updateEventFlg = false;
            //Wait Untill the EventDetails Page loads
            if (_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "60") == true)
            {

                eventStatus = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox);

                eventDisplay = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.eventDisplayStatusLstBx);

                if ("a" != eventStatus.ToLower())
                {
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox, "label=Active");
                    Console.WriteLine("Updated Event status to Active");
                    updateEventFlg = true;
                }

                if ("y" != eventDisplay.ToLower())
                {
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventDisplayStatusLstBx, "label=Yes");
                    Console.WriteLine("Updated Event display to Yes");
                    updateEventFlg = true;
                }

                if (updateEventFlg)
                {
                    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");
                    }
                    else
                    {
                        Console.WriteLine("Unable to update the event in Openbet");
                    }
                }
                browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            }
        }
Пример #46
0
        /// <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;
            }
        }
Пример #47
0
        /// <summary>
        /// Verifying market data in openbet
        /// </summary>
        /// <param name="browser">Browser instance</param>
        /// <param name="testData">Test data</param>
        public void VerifyMarketData(ISelenium browser, TestData testData)
        {
            string marketStatus = string.Empty;
            string marketDisplay = string.Empty;
            bool updateMarketFlg = false;

            if (_frameworkCommon.WaitUntilElementPresent(browser, "name=MktName", "60") == true)
            {

                marketStatus = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox);

                marketDisplay = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.mktDisplayListBox);

                if ("a" != marketStatus.ToLower())
                {
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Active");
                    Console.WriteLine("Updated Market status to Active");
                    updateMarketFlg = true;
                }

                if ("y" != marketDisplay.ToLower())
                {
                    browser.Select(AdminSuite.CommonControls.EventDetailsPage.mktDisplayListBox, "label=Yes");
                    Console.WriteLine("Updated market display to Yes");
                    updateMarketFlg = true;
                }

                if (updateMarketFlg)
                {
                    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"), "Event Updation is not Successfull");
                    }
                    else
                    {
                        Console.WriteLine("Unable to update the event in Openbet");
                    }
                }
                browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            }
        }
Пример #48
0
 public static bool IsNotPresentNow(this ISelenium sel, IBase iBase)
 {
     return(!sel.IsElementPresent(iBase.ToXPathExpression()));
 }
Пример #49
0
        /// <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);
            }
        }
Пример #50
0
        /// <summary>
        ///  Active the status of a customer
        /// </summary>
        ///  Author: Kiran
        /// <param name="browser">Browser Instance</param>
        /// <param name="userName">User Name</param>
        public void UpdateCustomerStatus(ISelenium browser, string userName, string status, string statusGroup, string statusReason)
        {
            //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.UpdateCustomerButton))
            {
                browser.Select(AdminSuite.CustomerCreation.CustomersPage.CustomerStatusLstBx, status);
                browser.Select(AdminSuite.CustomerCreation.CustomersPage.ReasonForSuspendingUserLstBx, statusGroup);
                Thread.Sleep(2000);
                browser.Select(AdminSuite.CustomerCreation.CustomersPage.StatusReasonLstBx, statusReason);

                browser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateCustomerButton);
                _frameworkCommon.WaitUntilAllElementsLoad(browser);
            }
        }
Пример #51
0
 /// <summary>
 /// To Update Customer Flag Information
 /// </summary>
 ///  Author: Anand
 /// <param name="flagName"> </param>
 /// <param name="flagVal"> </param>
 /// <param name="myBrowser"> </param>
 /// Ex: Adit_Test_SelfExcluded
 /// <returns>None</returns>
 /// Created Date: 12-April-2012
 public bool UpdateCustomerFlag(string flagName, string flagVal, ISelenium myBrowser)
 {
     try
     {
         // Navigating to MainFrame
         SelectMainFrame(myBrowser);
         IWebDriver driver = ((WebDriverBackedSelenium)myBrowser).UnderlyingWebDriver;
         Assert.IsTrue(myBrowser.IsElementPresent(AdminSuite.CustomerCreation.CustomersPage.ViewCustFlag), "Customer Flag Information table isnot found");
         myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.ViewCustFlag);
         myBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
         //Updating the customer flags
         Assert.IsTrue(driver.FindElement(By.XPath("//tr//td/b[text()='" + flagName + "']//ancestor::tr/td/Select")).Displayed, "Unable to navigate to Customer Flags page");
         myBrowser.Select("//tr//td/b[text()='" + flagName + "']//ancestor::tr/td/Select", flagVal);
         Assert.IsTrue(driver.FindElement(By.XPath("//th[@class='buttons']/input[@value='Update Customer Flags']")).Displayed, "Update Customer Flags button is not displayed in Customer Flags page");
         myBrowser.Click("//th[@class='buttons']/input[@value='Update Customer Flags']");
         myBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
         return true;
     }
     catch (Exception ex)
     {
         BaseTest.CaptureScreenshot(myBrowser, "");
         Console.WriteLine(ex.StackTrace);
         BaseTest.Fail(ex.Message);
         return false;
     }
 }
Пример #52
0
        }//end ClearTest

        ///<summary>
        ///Grab warrant data from http://www.hkex.com.hk/eng/dwrc/newissue/newlaunch.htm
        ///</summary>
        ///<returns> void </returns>
        private void WarrantDataCapture()
        {
            int start_position = startPosition;

            try
            {
                selenium1.OpenWindow("/eng/dwrc/newissue/newlaunch.htm", "WarrantListWindow");
                selenium1.WaitForPopUp("WarrantListWindow", "30000");
                selenium1.SelectWindow("WarrantListWindow");

                //Get English Content
                //while (selenium1.IsElementPresent("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[1]"))
                while (start_position <= endPosition && selenium1.IsElementPresent("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[1]"))
                {
                    String   launchDateStr    = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[11]");
                    DateTime tempLaunchDateDT = DateTime.ParseExact(launchDateStr, "dd-MM-yyyy", null);
                    DateTime temp             = coreObj.DateCalculate(scheduleDate, tempLaunchDateDT, holidayCount);

                    if (temp.Date == scheduleDate.Date)
                    {
                        HKRicTemplate hkRic = new HKRicTemplate();
                        hkRic.launchDateDT        = DateTime.ParseExact(launchDateStr, "dd-MM-yyyy", null);
                        hkRic.ricCodeStr          = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[2]");
                        hkRic.ricNameStr          = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[3]");
                        hkRic.issuerIDStr         = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[4]");
                        hkRic.underlyingStr       = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[5]");
                        hkRic.callPutStr          = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[6]");
                        hkRic.boardLotStr         = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[7]");
                        hkRic.strikeLevelStr      = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[8]");
                        hkRic.entitlementRatioStr = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[9]");
                        hkRic.issueSizeStr        = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[10]");
                        hkRic.clearingCommDateDT  = DateTime.ParseExact(selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[12]"), "dd-MM-yyyy", null);
                        hkRic.listingDateDT       = DateTime.ParseExact(selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[13]"), "dd-MM-yyyy", null);
                        hkRic.maturityDateDT      = DateTime.ParseExact(selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[14]"), "dd-MM-yyyy", null);


                        //Get issue price
                        String url        = selenium1.GetAttribute("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[2]/a@href");
                        String id         = url.Substring(url.IndexOf('=') + 1, 5);
                        String summaryUrl = "http://www.hkex.com.hk/eng/dwrc/dwsummary.asp?id=" + id;
                        selenium1.OpenWindow(summaryUrl, "WarrantSummaryWindow" + start_position);
                        selenium1.WaitForPopUp("WarrantSummaryWindow" + start_position, "30000");
                        selenium1.SelectWindow("WarrantSummaryWindow" + start_position);

                        //For Equity Get underlying name
                        if (Char.IsDigit(hkRic.underlyingStr, 0))
                        {
                            hkRic.underlyingNameForStockStr = selenium1.GetText("//table[@id='bodytable']/tbody/tr[3]/td[2]").Substring(8);
                        }

                        hkRic.issuePriceStr = selenium1.GetText("//table[@id='bodytable']/tbody/tr[11]/td[2]").Substring(4);

                        selenium1.Close();

                        ricList.Add(hkRic);


                        selenium1.SelectWindow("WarrantListWindow");
                    }//end if

                    start_position++;
                }//end while

                ChineseNameCapture(start_position);

                //Get gearing and premium
                //search on page http://www.hkexnews.hk/listedco/listconews/advancedsearch/search_active_main.asp
                DataCaptureFromPDF(0);
            }//end try
            catch (SeleniumException ex)
            {
                String errLog = ex.ToString();
                selenium1.Close();
                selenium1.Stop();
                CaptureRetry(start_position);
            }
        }//end WarrantDataCapture()
Пример #53
0
        public void UpdateEachWayByEventID(ISelenium browser, string eventId, string status)
        {
            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);
                _frameworkCommon.WaitUntilAllElementsLoad(browser);
                browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut);

                //browser.Click("label=|Race Winner|");

                if (browser.IsElementPresent(string.Format("link=|{0}|", "Race Winner")))
                {
                    browser.Click(string.Format("link=|{0}|", "Race Winner"));
                    _frameworkCommon.WaitUntilAllElementsLoad(browser);
                    browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut);

                    browser.Select("name=MktEWAvail", "label=" + status);

                    if (status == "Yes")
                    {
                        browser.Type(AdminSuite.CommonControls.EventDetailsPage.EachWayPlacesTxtBx, "1");
                        browser.Type(AdminSuite.CommonControls.EventDetailsPage.EachWayTopTxtBx, "1");
                        browser.Type(AdminSuite.CommonControls.EventDetailsPage.EachWayBottomTxtBx, "1");
                    }

                    browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);

                    //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");
                    }

                }
                else
                {
                    Console.WriteLine("Market is not available");
                }
                Thread.Sleep(3000);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                Console.WriteLine(ex.Message);
            }
        }