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


C# ISelenium.Close方法代码示例

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


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

示例1: ValidatePopupsofNFR

        ///<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);
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:45,代码来源:HomeGlobalFunctions.cs

示例2: VerifyPolicies

        ///<summary>
        /// This method verifies the all the policies on Home page 
        /// <example>VerifyPolicies(MyBrowser)</example>  
        public void VerifyPolicies(ISelenium browser, string[] Policies, string[] URLs)
        {
            try
            {
                string url, xPath;
                for (int i = 0; i < Policies.Length; i++)
                {
                    HGframeworkCommonObj.PageSync(browser);
                    xPath = "//a[starts-with(@class, 'bxc tac sec-button small footer') and contains(text(), '" + Policies[i] + "')]";

                    Assert.IsTrue(browser.IsElementPresent(xPath), Policies[i] + " button not found");
                    browser.Click(xPath);
                    HGframeworkCommonObj.PageSync(browser);
                    HGframeworkCommonObj.WaitUntilElementPresent(browser, LoginLogoutControls.alertContainer, "5000");
                    Thread.Sleep(1000);
                    Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.alertContainer), "Alert container was not displayed on tapping the '" + Policies[i] + "' link");
                    Assert.IsTrue(browser.IsTextPresent("You are about to navigate away from the site and any selections you have in the betslip may be lost"), "Warning message[1] is not displayed in the Alert container");
                    Assert.IsTrue(browser.IsTextPresent("Do you want to navigate away?"), "Warning message[2] is not displayed in the Alert container");
                    browser.Click(LoginLogoutControls.CloseButtonInAlertContainer);
                    HGframeworkCommonObj.PageSync(browser);
                    Assert.IsFalse(browser.IsVisible(LoginLogoutControls.alertContainer), "Alert container failed to close on tapping the Cancel button");

                    browser.Click(xPath);
                    HGframeworkCommonObj.WaitUntilElementPresent(browser, LoginLogoutControls.alertContainer, "5000");
                    Thread.Sleep(1000);
                    Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.alertContainer), "Alert container was not displayed on tapping the '" + Policies[i] + "' link");
                    browser.Click(LoginLogoutControls.ContinueButtonInAlertContainer);
                    HGframeworkCommonObj.PageSync(browser);
                    Thread.Sleep(2000);

                    //Title is different for Desktop policy
                    if (Policies[i] == "Desktop")
                    {
                        HGFcommonObj.SwitchWindow(browser, "Ladbrokes Mobile");
                    }
                    else
                    {
                        HGFcommonObj.SwitchWindow(browser, "LBR Customer KB");
                    }

                    url = browser.GetLocation();
                    // url = driver.Url;
                    browser.Close();
                    browser.SelectWindow("null");
                    Thread.Sleep(1000);

                    if (url.ToLower().Trim() == URLs[i].ToLower().Trim())
                    {
                        Console.WriteLine("'" + Policies[i] + "' validated successfully");
                    }
                    else
                    {
                        Console.WriteLine("Failed to validate the '" + Policies[i] + "'");
                        Fail("Mismatch in Actual and Expected URLs");
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Function 'VerifyPolicies' - Failed");
                Console.WriteLine(ex.Message);
                Fail(ex.Message);
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:67,代码来源:HomeGlobalFunctions.cs


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