private void FooterCertifications() { //ICANN Assert.Contains(PageInitHelper <FooterPageFactory> .PageInit.FooterIcannCertification.Text, UiConstantHelper.Icann); Assert.Contains(PageInitHelper <FooterPageFactory> .PageInit.FooterIcannCertification.Text, UiConstantHelper.AccreditedRegistrar); //Payment Options string footerPaymentOptions = ".//*[@id='footer']/*[contains(@class,'certifications')]/*[2]/dd"; for (int footerPaymentOption = 1; footerPaymentOption <= BrowserInit.Driver.FindElements(By.XPath(footerPaymentOptions)).Count; footerPaymentOption++) { string paymentOption = BrowserInit.Driver.FindElement(By.XPath(footerPaymentOptions + "[" + footerPaymentOption + "]")).Text; Assert.IsTrue(paymentOption.Contains(UiConstantHelper.AmericanExpress) || paymentOption.Contains(UiConstantHelper.Bitcoin) || paymentOption.Contains(UiConstantHelper.Dwolla) || paymentOption.Contains(UiConstantHelper.MasterCard) || paymentOption.Contains(UiConstantHelper.PayPal) || paymentOption.Contains(UiConstantHelper.Visa)); } //Security and Privacy Certifications string footerSecurityandPrivacy = ".//*[@id='footer']/*[contains(@class,'certifications')]/*[3]/li"; for (int footerSecurityandPrivacyLinks = 1; footerSecurityandPrivacyLinks <= BrowserInit.Driver.FindElements(By.XPath(footerSecurityandPrivacy)).Count; footerSecurityandPrivacyLinks++) { PageInitHelper <PageNavigationHelper> .PageInit.ScrollToElement(BrowserInit.Driver.FindElement(By.XPath(footerSecurityandPrivacy + "[" + footerSecurityandPrivacyLinks + "]/a"))); BrowserInit.Driver.FindElement(By.XPath(footerSecurityandPrivacy + "[" + footerSecurityandPrivacyLinks + "]/a")).Click(); PageInitHelper <WebPageResponse> .PageInit.VerifyPageWebResponseStatusCode(); var popupWindow = BrowserInit.Driver.WindowHandles.Count; if (popupWindow > 1) { BrowserInit.Driver.SwitchTo().Window(BrowserInit.Driver.WindowHandles[1]).Close(); BrowserInit.Driver.SwitchTo().Window(BrowserInit.Driver.WindowHandles.Last()); } else { BrowserInit.Driver.Navigate().Back(); } } }
private void FooterLegal() { //Footer Copyright string footerLegalCopyrightTxt = PageInitHelper <FooterPageFactory> .PageInit.FooterLegalCopyright.Text; Assert.Contains(footerLegalCopyrightTxt, UiConstantHelper.Copyright); Assert.Contains(footerLegalCopyrightTxt, DateTime.Now.Year.ToString()); //Footer Legal Links string footerLegalLinks = ".//*[@id='footer']/*[contains(@class,'legal')]/ul/li"; int footerLegalLinksCount = BrowserInit.Driver.FindElements(By.XPath(footerLegalLinks)).Count; for (int footerLegalLink = 1; footerLegalLink <= footerLegalLinksCount; footerLegalLink++) { BrowserInit.Driver.FindElement(By.XPath(footerLegalLinks + "[" + footerLegalLink + "]")).Click(); PageInitHelper <WebPageResponse> .PageInit.VerifyPageWebResponseStatusCode(); BrowserInit.Driver.Navigate().Back(); } }
private void FooterNewsLetterAndSocialNetwork() { //Footer Namecheap Logo string altTxt = PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapLogo.GetAttribute(UiConstantHelper.Alt).Trim(); Assert.Contains(altTxt, UiConstantHelper.Namecheap.Trim()); //Footer About Namecheap Assert.IsTrue(PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapAboutText.Displayed); PageInitHelper <PageNavigationHelper> .PageInit.ScrollToElement(PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapAboutLink); PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapAboutLink.Click(); PageInitHelper <WebPageResponse> .PageInit.VerifyPageWebResponseStatusCode(); BrowserInit.Driver.Navigate().Back(); //Footer Namecheap Blog PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapAboutBlogLink.Click(); PageInitHelper <WebPageResponse> .PageInit.VerifyPageWebResponseStatusCode(); BrowserInit.Driver.Navigate().Back(); //Footer Newsletter Form Assert.Contains(PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapNewsletter.Text, UiConstantHelper.Newsletter); Assert.IsTrue(PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapNewsletterPeriodic.Displayed); foreach (var footerNewsletter in PageInitHelper <FooterPageFactory> .PageInit.FooterNamecheapJoinNewsletter) { string inputAttribute = footerNewsletter.GetAttribute(UiConstantHelper.Name); Assert.IsTrue(inputAttribute.Contains(UiConstantHelper.Email.ToLower()) || inputAttribute.Contains(UiConstantHelper.Action)); } //Footer Social string footerSocial = "//*[@id='footer']//*[contains(@class,'social')]/li"; int footerSocialCount = BrowserInit.Driver.FindElements(By.XPath(footerSocial)).Count; for (int social = 1; social <= footerSocialCount; social++) { BrowserInit.Driver.FindElement(By.XPath(footerSocial + "[" + social + "]")).GetAttribute(UiConstantHelper.AttributeClass); BrowserInit.Driver.FindElement(By.XPath(footerSocial + "[" + social + "]/a")).Click(); PageInitHelper <WebPageResponse> .PageInit.VerifyPageWebResponseStatusCode(); BrowserInit.Driver.Navigate().Back(); } }