当前位置: 首页>>代码示例>>C#>>正文


C# ISelenium.WindowFocus方法代码示例

本文整理汇总了C#中ISelenium.WindowFocus方法的典型用法代码示例。如果您正苦于以下问题:C# ISelenium.WindowFocus方法的具体用法?C# ISelenium.WindowFocus怎么用?C# ISelenium.WindowFocus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISelenium的用法示例。


在下文中一共展示了ISelenium.WindowFocus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterCustomer_selfExclusion

        ///<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 = "AutoUser" + 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 = "12345678";
                string confirmPassword = "12345678";
                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);

//.........这里部分代码省略.........
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:101,代码来源:MobileLobbyFunctions.cs


注:本文中的ISelenium.WindowFocus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。