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


C# ISelenium.IsVisible方法代码示例

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


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

示例1: Login

        ///<summary>
        /// This method loggsin to the application
        /// <example>Login(browser, "arun_ecomm_test", "123456") </example>
        public void Login(ISelenium browser, string username, string password)
        {
            try
            {
                IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.LadbrokesHomeLink), "Header(Ladbrokes Logo) is not displayed on Home page");
                Assert.IsTrue(browser.IsVisible(BetslipControls.betslipButton), "Betslip button is not displayed on Home page");

                LFcommonObj.selectMenuButton(browser);
                Assert.IsFalse(browser.IsVisible(LoginLogoutControls.logoutLink), "Logout link is present in the sidebar(User Logged in");
                LFcommonObj.clickObject(browser, LoginLogoutControls.loginOrRegisterLink);

                // Check for the Login page elements
                LFframeworkCommonObj.WaitUntilElementPresent(browser, LoginLogoutControls.loginUsernameTextBox, FrameGlobals.ElementLoadTimeout.ToString());
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.loginBanner), "Login header is not present in mobile's login page");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.LadbrokesHomeLink), "Ladbrokes Logo is not present in mobile's login page");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.loginUsernameTextBox), "User name field is not present in mobile's login page");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.loginPasswordTextBox), "Password field is not present in mobile's login page");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.lostLoginButton), "Lost Login button is not present in mobile's login page");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.newToLadbrokesBanner), "New to Ladbrokes banner is not present in mobile's login page");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.registerButton), "Register button is not present in mobile's login page");
                Assert.IsTrue(browser.IsVisible(BetslipControls.betslipButton), "Betslip button is not present in mobile's login page");

                //Login
                LFcommonObj.EnterField(browser, LoginLogoutControls.loginUsernameTextBox, username);
                LFcommonObj.EnterField(browser, LoginLogoutControls.loginPasswordTextBox, password);
                //LFcommonObj.clickObject(browser, LoginLogoutControls.loginSubmitButton);
                browser.FireEvent(LoginLogoutControls.loginSubmitButton, "click");
                LFcommonObj.WaitForLoadingIcon(browser, FrameGlobals.IconLoadTimeout);

                //Check elements on Login FrameGlobals.ElementLoadTimeout + 10000
                //LFframeworkCommonObj.WaitUntilElementPresent(browser, LoginLogoutControls.balance, 30000.ToString());
                //Thread.Sleep(10000);
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.balance), "Balance is not displayed on Login");
                Console.WriteLine("Login was successful");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Function 'Login' - Failed");
                Console.WriteLine(ex.Message);
                Fail(ex.Message);
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:46,代码来源:LoginLogoutFunctions.cs

示例2: CaptureLoginErrorMessage

        ///<summary>
        /// This method captures the error message displayed when attempts to login with invalid credentials
        /// <example>CaptureLoginErrorMessage(browser, "ecomm_test_user", "123456")</example>
        public string CaptureLoginErrorMessage(ISelenium browser, string userName, string password)
        {
            try
            {
                IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;
                LFcommonObj.selectMenuButton(browser);
                LFcommonObj.clickObject(browser, LoginLogoutControls.loginOrRegisterLink);

                LFframeworkCommonObj.WaitUntilElementEditable(browser, LoginLogoutControls.loginUsernameTextBox, "10000");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.loginBanner), "Login page not displayed");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.loginUsernameTextBox), "Username field not presesnt in Login page");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.loginPasswordTextBox), "Password field not presesnt in Login page");

                browser.Type(LoginLogoutControls.loginUsernameTextBox, "");
                if (userName != null)
                {
                    browser.Type(LoginLogoutControls.loginUsernameTextBox, userName);
                }

                browser.Type(LoginLogoutControls.loginPasswordTextBox, "");
                if (password != null)
                {
                    browser.Type(LoginLogoutControls.loginPasswordTextBox, password);
                }

                browser.FireEvent(LoginLogoutControls.loginSubmitButton, "click");
                LFcommonObj.WaitForLoadingIcon(browser, FrameGlobals.IconLoadTimeout);
                Thread.Sleep(1000);
                return driver.FindElement(By.XPath(LoginLogoutControls.loginErrorpanel)).Text;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Function 'CaptureLoginErrorMessage' - Failed");
                Console.WriteLine(ex.Message);
                Fail(ex.Message);
                return null;
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:41,代码来源:LoginLogoutFunctions.cs

示例3: CheckElementPresent

 ///<summary>
 /// This method checks for the existance of an element(button, link..)
 /// <example>CheckElementPresent(browser, xPath)</example>        
 public void CheckElementPresent(ISelenium browserObj, string strLocator)
 {
     try
     {
         WaitForLoadingIcon(browserObj, Convert.ToInt32(FrameGlobals.IconLoadTimeout));
         Assert.IsTrue(browserObj.IsVisible(strLocator), strLocator + " element is not present");
     }
     catch (Exception ex)
     {
         Console.WriteLine("Function 'CheckElementPresent' - Failed");
         Console.WriteLine(ex.Message);
         Fail(ex.Message);
     }
 }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:17,代码来源:Common.cs

示例4: clickObject_MobileLobby

 ///<summary>
 /// This method clicks on any desired object(button, link)
 /// <example>clickObject_MobileLobby(browser, xPath)</example>        
 public void clickObject_MobileLobby(ISelenium browserObj, string strLocator)
 {
     try
     {
         Assert.IsTrue(browserObj.IsVisible(strLocator), strLocator + " element is not present");
         browserObj.Focus(strLocator);
         browserObj.Click(strLocator);
         WaitForLoadingIcon_MobileLobby(browserObj, Convert.ToInt32(FrameGlobals.IconLoadTimeout));
     }
     catch (Exception ex)
     {
         Console.WriteLine("Function 'clickObject' - Failed");
         Console.WriteLine(ex.Message);
         Fail(ex.Message);
     }
 }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:19,代码来源:MobileLobbyFunctions.cs

示例5: 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

示例6: NavigateToRegistrationPage

        ///<summary>
        /// This method navigates to the Registration page
        /// <example>NavigateToRegistrationPage(browser) </example>
        public void NavigateToRegistrationPage(ISelenium browser)
        {
            try
            {
                MLcommonObj.selectMenuButton(browser);
                MLcommonObj.clickObject(browser, LoginLogoutControls.loginOrRegisterLink);

                // Check for the Login page elements
                MLframeworkCommonObj.WaitUntilElementPresent(browser, LoginLogoutControls.registerButton, FrameGlobals.ElementLoadTimeout.ToString());
                clickObject_MobileLobby(browser, LoginLogoutControls.registerButton);
                // check for the floowing elements
                Assert.IsTrue(browser.IsVisible(MobileLobbyControls.Logo), "Ladbrokes Logo was not found on the Registration page");
                Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Failed to navigate to Registration page, Registration title not found");
                Assert.IsTrue(browser.IsVisible(MobileLobbyControls.closebutton), "Close button was found on the Registration page");
                Assert.IsTrue(browser.IsVisible(MobileLobbyControls.licenseText), "Lisence text was not found on the Registration page");
                Console.WriteLine("Successfully navigated to Lobby registration page");
            }
            catch (Exception ex)
            {
                CaptureScreenshot(browser, "");
                Console.WriteLine("Function 'NavigateToRegistrationPage' - Failed");
                Console.WriteLine(ex.Message);
                Fail(ex.Message);
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:28,代码来源:MobileLobbyFunctions.cs

示例7: WaitForLoadingIcon

        /// <summary>
        /// This method will wait for loader icon to complete loading
        /// </summary>
        /// <param name="browserObj">Browser Instance</param>
        /// <param name="timeout">Timeout in seconds</param>
        /// <example>WaitForLoadingIcon(browser,60)</example>      
        public void WaitForLoadingIcon(ISelenium browserObj, int timeout)
        {
            IWebDriver driver = ((WebDriverBackedSelenium)browserObj).UnderlyingWebDriver;
            //CFframeworkCommonObj.PageSync(browserObj);
            DateTime now;
            DateTime delay1 = DateTime.Now.AddSeconds(timeout);
            while (browserObj.IsVisible(LoginLogoutControls.loadingIcon1))
            {
                now = DateTime.Now;
                if (now < delay1)
                {
                    continue;
                }
                else
                {
                    break;
                }
            }

            DateTime delay2 = DateTime.Now.AddSeconds(timeout);
            while (browserObj.IsVisible(LoginLogoutControls.loadingIcon2))
            {
                now = DateTime.Now;
                if (now < delay2)
                {
                    continue;
                }
                else
                {
                    break;
                }
            }

            DateTime delay3 = DateTime.Now.AddSeconds(timeout);
            while (browserObj.IsVisible(LoginLogoutControls.loadingIcon3))
            {
                now = DateTime.Now;
                if (now < delay3)
                {
                    continue;
                }
                else
                {
                    break;
                }
            }
            CFframeworkCommonObj.PageSync(browserObj);
            TimeSpan ts = new TimeSpan(0, 0, 0);
            driver.Manage().Timeouts().ImplicitlyWait(ts);
            if (browserObj.IsElementPresent(LoginLogoutControls.InfoPageCloseBtn))
            {
                browserObj.Click(LoginLogoutControls.InfoPageCloseBtn);
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:60,代码来源:Common.cs

示例8: SelectValueFromListbox

 ///<summary>
 /// This method selects avalue from list/combo box
 /// <example>SelectValueFromListbox(browser, xPath, value)</example>       
 public void SelectValueFromListbox(ISelenium browserObj, string strLocator, string value)
 {
     try
     {
         CFframeworkCommonObj.PageSync(browserObj);
         Assert.IsTrue(browserObj.IsVisible(strLocator), strLocator + " element is not present");
         string[] itemArray = browserObj.GetSelectOptions(strLocator);
         for (int i = 0; i < itemArray.Length; i++)
         {
             if (itemArray[i].ToLower().Trim() == value.ToLower().Trim())
             {
                 browserObj.Select(strLocator, value);
                 CFframeworkCommonObj.PageSync(browserObj);
                 break;
             }
             else
             {
                 if (i == itemArray.Length - 1)
                 {
                     Console.WriteLine(value + " not found in the list box");
                     Fail(value + " not found in the list box");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Function 'SelectValueFromListbox' - Failed");
         Console.WriteLine(ex.Message);
         Fail(ex.Message);
     }
 }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:35,代码来源:Common.cs

示例9: SelectionStatusValidation

        /// <summary>
        /// Method to update and validate Selection status validation
        /// </summary>
        public void SelectionStatusValidation(ISelenium browser, ISelenium adminBrowser, TestData testData, string navPanel,string eventName)
        {
            string selectionId = string.Empty;

            try
            {
                btCommonObj.AddAndVerifySelectionInBetslip_HR(browser, testData.ClassName, navPanel, testData.ClassName, testData.TypeName, testData.SubTypeName, testData.EventName, testData.MarketName, testData.SelectionName, testData.Odds, false, false);
                selectionId = testRepositoryCommonObj.GetSelectionIDFromBetslip(browser, testData.SelectionName, testData.EventName);

                adminCommonObj.UpdateSelection(adminBrowser, selectionId, testData.Odds, "Suspended", "");
                Thread.Sleep(FrameGlobals.OpenBetReflectTimeOut);

                btCommonObj.NavigateToEventDetailsPage(browser, testData.ClassName, navPanel, testData.ClassName, testData.TypeName, testData.SubTypeName, eventName, testData.MarketName);
                Assert.IsFalse(browser.IsVisible("//div[@class='bxcl bg2 mb4' and contains(string(),'" + testData.SelectionName + "')]//a"),
                                                                        "Selection is not displayed in the event details page");
                Console.WriteLine("" + eventName + " selections were suspended and updated in event details page navigated through Today tab from Hr home page");

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                CaptureScreenshot(browser, "SelectionStatusValidation");
            }
            finally
            {
                adminCommonObj.UpdateSelection(adminBrowser, selectionId, testData.Odds, "Active", "");
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:31,代码来源:HorseRacingFuntions.cs

示例10: WaitForLoadingIcon_MobileLobby

        /// <summary>
        /// This method will wait for loader icon to complete loading
        /// <param name="browserObj">Browser Instance</param>
        /// <param name="timeout">Timeout in seconds</param>
        /// <example>WaitForLoadingIcon(browser,60)</example>      
        public void WaitForLoadingIcon_MobileLobby(ISelenium browserObj, int timeout)
        {
            MLframeworkCommonObj.PageSync(browserObj);
            DateTime now;

            DateTime delay = DateTime.Now.AddSeconds(timeout);
            while (browserObj.IsVisible(MobileLobbyControls.lbLoadingIcon))
            {
                now = DateTime.Now;
                if (now < delay)
                {
                    continue;
                }
                else
                {
                    break;
                }
            }
            MLframeworkCommonObj.PageSync(browserObj);
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:25,代码来源:MobileLobbyFunctions.cs

示例11: VerifyDetailsOnLogout

        ///<summary>
        /// This method verifies the details, links once the user has logged out
        /// <example>VerifyDetailsOnLogout(browser)</example>
        public void VerifyDetailsOnLogout(ISelenium browser)
        {
            try
            {
                IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;
                IJavaScriptExecutor js = (IJavaScriptExecutor)driver;

                Assert.IsFalse(browser.IsVisible(LoginLogoutControls.sidebar), "Sidebar failed to close on Logout");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.LadbrokesHomeLink), "Header(Ladbrokes Logo) is not displayed on Home page after Logout");
                Assert.IsFalse(browser.IsVisible(LoginLogoutControls.balance), "Balance is displayed after Logout");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.carousel), "Carousel is not found on Home page on logout");

                //Assert.IsTrue(browser.IsVisible(LoginLogoutControls.promotionalBanner), "Promotional banner is not displayed on Home page");

                LFcommonObj.selectMenuButton(browser);
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.loginOrRegisterLink), "Login/Register element is not present after Logout");
                Assert.IsFalse(browser.IsVisible(LoginLogoutControls.logoutLink), "Logout link is present after Logout");
                //browser.Click(LoginLogoutControls.menuIcon);
                js.ExecuteScript("document.getElementById('menu-button').click()");
                LFframeworkCommonObj.PageSync(browser);

                Console.WriteLine("Verification of UI object on Logout was successful");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Function 'VerifyDetailsOnLogout' - Failed");
                Console.WriteLine(ex.Message);
                Fail(ex.Message);
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:33,代码来源:LoginLogoutFunctions.cs

示例12: VerifyDetailsOnLogin

        ///<summary>
        /// This method verifies the all details, links once the user has logged in 
        /// <example>VerifyDetailsOnLogin(browser)</example>
        public void VerifyDetailsOnLogin(ISelenium browser)
        {
            try
            {
                IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;

                //Check elements on Login
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.balance), "Balance is not displayed on Login");
                LFcommonObj.selectMenuButton(browser);
                IWebElement username = driver.FindElement(By.XPath("//div[@id='sidebar-user-name' and contains(string(), '" + FrameGlobals.UserDisplayName + "')]"));
                Assert.IsTrue(username.Displayed, "User name '" + FrameGlobals.UserDisplayName + "' is not diplayed on Login");
                Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.logoutLink), "Logout link is not present in the sidebar on Login");

                //Verify the links under account
                LFcommonObj.clickObject(browser, LoginLogoutControls.accountLink);
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.deposit), "Deposit link is not present in the Account section");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.withdraw), "Withdraw link is not present in the Account section");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.histroy), "Histroy link is not present in the Account section");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.viewBalances), "View Balances link is not present in the Account section");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.Transfer), "Transfer link is not present in the Account section");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.redeemFreeBets), "Redeem Free Bets link is not present in the Account section");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.depositLimits), "Deposit Limits link is not present in the Account section");
                LFcommonObj.clickObject(browser, LoginLogoutControls.accountLink);

                //Verify links on Sidebar
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.moreFromLadbrokes), "More from Ladbrokes link is not present in the sidebar");
                LFcommonObj.clickObject(browser, LoginLogoutControls.homeLinkOnSideBar);
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.balance), "Failed to navigate to 'Home Page' on tapping the Home icon in the sidebar");
                Assert.IsFalse(browser.IsVisible(LoginLogoutControls.sidebar), "Side bar remians on navigating on the home page");
                Console.WriteLine("Verification of UI object on Login was successful");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Function 'VerifyDetailsOnLogin' - Failed");
                Console.WriteLine(ex.Message);
                Fail(ex.Message);
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:41,代码来源:LoginLogoutFunctions.cs

示例13: Logout

        ///<summary>
        /// This method logs the user out of the application
        /// <example>Logout(browser)</example>
        public void Logout(ISelenium browser)
        {
            try
            {
                IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;
                LFcommonObj.selectMenuButton(browser);
                Assert.IsFalse(browser.IsVisible(LoginLogoutControls.loginOrRegisterLink), "User is not logged in");
                //LFcommonObj.clickObject(browser, LoginLogoutControls.logoutLink, "xpath");
                IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                js.ExecuteScript("logoutObj=document.getElementsByClassName('bxc sidebar-icon logout ml20');logoutObj.item(0).click()");
                //js.ExecuteScript("anf = document.getElementById('sidebar-scroll');divName = anf.childNodes[1];ulList = divName.childNodes[9].childNodes;bb = ulList[17].childNodes;bb.item(1).click()");

                //Actions builder = new Actions(driver);
                //IWebElement helpWebElement = driver.FindElement(By.XPath(LoginLogoutControls.logoutLink));
                //builder.MoveToElement(helpWebElement).Build().Perform();

                LFcommonObj.WaitForLoadingIcon(browser, FrameGlobals.ElementLoadTimeout);
                Assert.IsFalse(browser.IsVisible(LoginLogoutControls.balance), "Balance is displayed after Logout");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.LadbrokesHomeLink), "Home page is not displayed on logout");
                Assert.IsTrue(browser.IsVisible(LoginLogoutControls.carousel), "Carousel is not found on Home page on logout");
                Console.WriteLine("Logout was successful");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Function 'Logout' - Failed");
                Console.WriteLine(ex.Message);
                Fail(ex.Message);
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:32,代码来源:LoginLogoutFunctions.cs

示例14: 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

示例15: RegisterCustomer

        ///<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 = "AutoUser" + 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;
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:82,代码来源:MobileLobbyFunctions.cs


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