Example #1
0
 public static void ClickSigninBtn(RemoteWebDriver driver)
 {
     Selenide.BrowserBack(driver);
     //"Click Sign in from the navigation bar"
     Selenide.Wait(driver, 5, true);
     Selenide.ScrollToElement(driver, Util.GetLocator("Signin_btn"));
     Selenide.Click(driver, Util.GetLocator("Signin_btn"));
 }
Example #2
0
 /* VerifyPage method verifying page should redirect to respective page */
 public static void VerifyPage(RemoteWebDriver driver)
 {
     System.Threading.Thread.Sleep(2000);
     Selenide.Query.isElementInvisible(driver, Util.GetLocator("ScheduleTourLink"));
     test.Log(LogStatus.Pass, "knockrentals home pahe displayed");
     Common.Takescreenshot(driver);
     Selenide.Wait(driver, 5, true);
 }
Example #3
0
 public static void Logout(RemoteWebDriver driver, string username)
 {
     ////(new Act("Logoutfrom application"));
     Selenide.Wait(driver, 4, true);
     Selenide.Click(driver, Locator.Get(LocatorType.XPath, "//span[text()='" + username + "']"));
     Selenide.WaitForElementVisible(driver, Util.GetLocator("signOutLink"));
     Selenide.Click(driver, Util.GetLocator("signOutLink"));
     test.Log(LogStatus.Pass, "Log out");
 }
Example #4
0
 //Select avalable date
 public static void SelectAvalabledate(RemoteWebDriver driver)
 {
     test.Log(LogStatus.Pass, "Select avalable Date");
     Selenide.Click(driver, Util.GetLocator("ScheduleTourLink"));
     Selenide.Wait(driver, 5, true);
     Selenide.Query.isElementInvisible(driver, Util.GetLocator("BooktourBtn"));
     test.Log(LogStatus.Pass, "Schedule tour window displayed");
     Common.Takescreenshot(driver);
     Selenide.Wait(driver, 5, true);
 }
Example #5
0
 public static void HandleSync(RemoteWebDriver driver, Locator ElementToNoLongerVisible)
 {
     Selenide.Wait(driver, 1, true);
     try
     {
         Selenide.WaitforElementDisappear(driver, ElementToNoLongerVisible);
     }
     catch (Exception e)
     {
         //Selenide.Wait(driver,Common.HandleSync(driver), true);
     }
 }
Example #6
0
        //Handle sync just time
        public static int HandleSync(RemoteWebDriver driver, bool invoked = true)
        {
            string s    = ConfigurationManager.AppSettings.Get("HandleSync").ToString();
            int    time = Convert.ToInt32(ConfigurationManager.AppSettings.Get("HandleSyncTime").ToString());

            if (invoked)
            {
                if (s.Contains("Y") && invoked)
                {
                    Selenide.Wait(driver, time, true);
                }
            }
            return(time);
        }
Example #7
0
        public static void ClickMetricBtn(RemoteWebDriver driver)
        {
            //Click the "Non Show Metric" button
            Selenide.Wait(driver, 5, true);
            Selenide.ScrollToElement(driver, Util.GetLocator("ShowMetricBtn"));
            Selenide.Click(driver, Util.GetLocator("ShowMetricBtn"));
            Selenide.Wait(driver, 5, true);
            //Verify that the non-metric value is not present
            //Validate in kilometers
            Selenide.Query.isElementVisible(driver, Util.GetLocator("Kilometers695700"));
            test.Log(LogStatus.Pass, "The radius of the sun is 432300 kilometers displayed");

            bool nonmetricvalue = Selenide.Query.isElementVisibleboolValue2(driver, Util.GetLocator("Radiussun432300"));

            if (!nonmetricvalue)
            {
                test.Log(LogStatus.Pass, "The metric value is not present");
            }
            else
            {
                throw new Exception("The non metric value displayed");
            }
        }
Example #8
0
        //Click on schedule Link
        public static void ClickScheduleTourLink(RemoteWebDriver driver)
        {
            Selenide.Wait(driver, 3, true);
            test.Log(LogStatus.Pass, "Click on Schedule Tour Link");
            driver.SwitchTo().Frame(2);
            Selenide.Click(driver, Locator.Get(LocatorType.XPath, "//html/body/div/descendant::li/button[text()='Schedule a Tour']"));
            Selenide.Wait(driver, 3, true);
            driver.SwitchTo().DefaultContent();

            driver.SwitchTo().Frame(2);
            test.Log(LogStatus.Pass, "Select avalable Date");
            Selenide.Click(driver, Locator.Get(LocatorType.ID, "date"));
            Selenide.Wait(driver, 3, true);
            Selenide.Click(driver, Locator.Get(LocatorType.XPath, "(//td[@aria-disabled='false'])[1]"));
            //Selenide.JS.Click(driver, Locator.Get(LocatorType.XPath, "(//td[@aria-disabled='false'])[2]"));

            //Select time
            Selenide.Wait(driver, 3, true);
            Selenide.SetText(driver, Locator.Get(LocatorType.XPath, "//select[@tabindex='3']"), Selenide.ControlType.Index, "0");
            //Selenide.Click(driver, Locator.Get(LocatorType.XPath, "//select/option[text()='11:00 am']"));

            //Enter First Name
            Random _random = new Random();
            string uniqnum = _random.Next(0, 9999).ToString("0000");

            Selenide.SetText(driver, Locator.Get(LocatorType.XPath, "//input[@placeholder='First name']"), Selenide.ControlType.Textbox, "AutoFirst" + uniqnum);
            test.Log(LogStatus.Pass, "Entered First Name : AutoFirst" + uniqnum);

            //LastName
            Selenide.SetText(driver, Locator.Get(LocatorType.XPath, "//input[@placeholder='Last name']"), Selenide.ControlType.Textbox, "AutoLast" + uniqnum);
            test.Log(LogStatus.Pass, "Enter Last Name : AutoLast" + uniqnum);

            //Email
            Selenide.SetText(driver, Locator.Get(LocatorType.XPath, "//input[@placeholder='Email']"), Selenide.ControlType.Textbox, "AutoEmail" + uniqnum + "@gmail.com");
            test.Log(LogStatus.Pass, "Entered Email as : AutoEmail" + uniqnum + "@gmail.com");

            //Uniq Phone Number

            Random rand        = new Random(100);
            int    phoneNumber = rand.Next(0000000000, 999999999);

            //Phone Number
            Selenide.SetText(driver, Locator.Get(LocatorType.XPath, "//input[@placeholder='Phone']"), Selenide.ControlType.Textbox, "9" + phoneNumber.ToString());
            test.Log(LogStatus.Pass, "Entered Phone Number 9" + phoneNumber.ToString());

            //Message
            test.Log(LogStatus.Pass, "Enter Message");
            Selenide.SetText(driver, Locator.Get(LocatorType.XPath, "//textarea[@placeholder='Add your message']"), Selenide.ControlType.Textbox, "Hello This is Testing");

            //Bedrooms
            test.Log(LogStatus.Pass, "Select Bedrooms in dropdown");
            Selenide.Click(driver, Locator.Get(LocatorType.XPath, "//select/option[text()='2 bedroom']"));

            //Unit
            test.Log(LogStatus.Pass, "Select Unit");
            Selenide.Click(driver, Locator.Get(LocatorType.XPath, "//select/option[text()='$1312 - 1bd 1ba - Unit 321, Avail Today']"));

            //BookTour Button
            test.Log(LogStatus.Pass, "Click BookTour button");
            Selenide.Click(driver, Util.GetLocator("BooktourBtn"));

            Selenide.Wait(driver, 3, true);
            driver.SwitchTo().DefaultContent();

            Selenide.Wait(driver, 3, true);
            driver.SwitchTo().Frame(2);
            //div[@class='doorway-plugin-header doorway-themed-bg']/span
            Selenide.Wait(driver, 3, true);
            string txt = Selenide.GetText(driver, Locator.Get(LocatorType.XPath, "//div[@class='doorway-plugin-header doorway-themed-bg']//span"), Selenide.ControlType.Label);

            if (txt == "You're booked with Apartment Test 2")
            {
                test.Log(LogStatus.Pass, "Appointment Booked successfully");
                Common.Takescreenshot(driver);
            }
            else
            {
                test.Log(LogStatus.Fail, "Appointment Not Booked successfully");
                Common.Takescreenshot(driver);
            }
        }
        private static List <Dictionary <string, string> > DataExtractFromHuff(RemoteWebDriver driver, Iteration reporter, string sitename, List <string> urls, int k)
        {
            List <Dictionary <string, string> > data = new List <Dictionary <string, string> >();

            try
            {
                IList <IWebElement> Stories = driver.FindElementsByXPath(Util.GetLocator("StoryCount_HFP").Location);

                if (Stories.Count > 2)
                {
                    //tring to get all urls in one go
                    foreach (IWebElement story in Stories)
                    {
                        urls.Add(story.GetAttribute("href"));
                    }
                    var DistinctList = urls.Distinct();

                    reporter.Add(new Act("Got <b>" + DistinctList.Count() + "</b> Stories"));
                    foreach (string url in DistinctList)
                    {
                        if (url.StartsWith("https://www.huffingtonpost.com/entry/"))
                        {
                            Selenide.NavigateTo(driver, url);

                            Dictionary <string, string> tempdict = new Dictionary <string, string>();
                            try
                            {
                                if (driver.FindElementsById(Util.GetLocator("Story_HFP").Location).Count > 0)
                                {
                                    IList <IWebElement> StoryHeader = driver.FindElementsByXPath(Util.GetLocator("storyHeader_HFP").Location);
                                    IList <IWebElement> Story       = driver.FindElementsById(Util.GetLocator("Story_HFP").Location);
                                    string metadata = "";
                                    try
                                    {
                                        if (Selenide.Query.isElementVisibleboolValue(driver, Util.GetLocator("storyHeaderMeta_HFP"), false))
                                        {
                                            metadata = driver.FindElementByXPath(Util.GetLocator("storyHeaderMeta_HFP").Location).Text;
                                        }
                                    }
                                    catch (Exception e)
                                    {
                                    }
                                    string totalstory = "";

                                    string storyheader = StoryHeader[0].Text;

                                    IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                                    try
                                    {
                                        totalstory = (string)js.ExecuteScript("return document.getElementsByClassName('" + Util.GetLocator("Story_HFP_cn").Location + "')[0].innerText;");
                                        tempdict.Add(storyheader + metadata, totalstory);
                                    }
                                    catch
                                    {
                                        for (int i = 0; i < Story.Count; i++)
                                        {
                                            new Actions(driver).MoveToElement(Story[i]).Perform();
                                            Selenide.Wait(driver, 1, true);
                                            totalstory += Story[i].Text;
                                        }
                                        tempdict.Add(storyheader + metadata, totalstory);
                                    }

                                    data.Add(tempdict);
                                }
                                else
                                {
                                    reporter.Add(new Act("Current url is not working for the known scheme ::" + url));
                                }
                            }
                            catch (Exception e)
                            {
                                continue;
                            }
                        }
                    }
                }
                Selenide.NavigateTo(driver, sitename);
                if (Selenide.Query.isElementExist(driver, Locator.Get(LocatorType.XPath, "//*[@id='pagination']/div[2]//a[contains(@href,'?page=" + k + "')]"), false))
                {
                    try
                    {
                        Selenide.Click(driver, Locator.Get(LocatorType.XPath, "//*[@id='pagination']/div[2]//a[contains(@href,'?page=" + k + "')]"));
                        //driver.FindElementByXPath("//*[@id='pagination']/div[2]//a[contains(@href,'?page=2')]").Click();
                    }
                    catch (Exception e)
                    {
                        reporter.Add(new Act("Click never happened for page ::" + k));
                    }
                }
            }
            catch (Exception e)
            {
            }

            return(data);
        }
        private static List <Dictionary <string, string> > ChooseDataRetrevalScheme(RemoteWebDriver driver, Iteration reporter, string sitename)
        {
            List <string> urls = new List <string>();
            List <Dictionary <string, string> > data = new List <Dictionary <string, string> >();

            try
            {
                if (sitename.ToLower().Contains("abcnews"))
                {
                    IList <IWebElement> Stories = driver.FindElementsByXPath(Util.GetLocator("StoryCount").Location);

                    if (Stories.Count > 2)
                    {
                        //tring to get all urls in one go
                        foreach (IWebElement story in Stories)
                        {
                            urls.Add(story.GetAttribute("href"));
                        }
                        var DistinctList = urls.Distinct();
                        reporter.Add(new Act("Got <b>" + DistinctList.Count() + "</b> Stories"));
                        foreach (string url in DistinctList)
                        {
                            if (url.StartsWith("http://abcnews.go.com"))
                            {
                                Selenide.NavigateTo(driver, url);

                                IList <IWebElement> StoryHeader = driver.FindElementsByXPath(Util.GetLocator("storyHeader").Location);
                                IList <IWebElement> Story       = driver.FindElementsByXPath(Util.GetLocator("Story").Location);

                                Dictionary <string, string> tempdict = new Dictionary <string, string>();
                                for (int i = 0; i < StoryHeader.Count; i++)
                                {
                                    tempdict.Add(StoryHeader[i].Text, Story[i].Text);
                                }

                                data.Add(tempdict);
                            }
                        }
                    }
                }
                else if (sitename.ToLower().Contains("cbsnews"))
                {
                    IList <IWebElement> Stories = driver.FindElementsByXPath(Util.GetLocator("StoryCount_CBS").Location);

                    if (Stories.Count > 2)
                    {
                        //tring to get all urls in one go
                        foreach (IWebElement story in Stories)
                        {
                            urls.Add(story.GetAttribute("href"));
                        }
                        var DistinctList = urls.Distinct();
                        reporter.Add(new Act("Got <b>" + DistinctList.Count() + "</b> Stories"));
                        foreach (string url in DistinctList)
                        {
                            if ((url != null && !url.StartsWith("https://www.cbsnews.com/video/")) && (url.StartsWith("https://www.cbsnews.com/news/")))
                            {
                                Selenide.NavigateTo(driver, url);

                                Dictionary <string, string> tempdict = new Dictionary <string, string>();
                                try
                                {
                                    IList <IWebElement> StoryHeader = driver.FindElementsByXPath(Util.GetLocator("storyHeader_CBS").Location);
                                    IList <IWebElement> Story       = driver.FindElementsByXPath(Util.GetLocator("Story_CBS").Location);
                                    string metadata = driver.FindElementByXPath(Util.GetLocator("storyHeaderMeta_CBS").Location).Text;

                                    for (int i = 0; i < StoryHeader.Count; i++)
                                    {
                                        tempdict.Add(StoryHeader[i].Text + " " + metadata, Story[i].Text);
                                    }
                                }
                                catch (Exception e)
                                {
                                    reporter.Add(new Act("Url doesnot fit current scheme " + url));
                                    continue;
                                }

                                data.Add(tempdict);
                            }
                        }
                    }
                }
                else if (sitename.ToLower().Contains("cnn"))
                {
                    IList <IWebElement> Stories = driver.FindElementsByXPath(Util.GetLocator("StoryCount_CNN").Location);

                    if (Stories.Count > 2)
                    {
                        //tring to get all urls in one go
                        foreach (IWebElement story in Stories)
                        {
                            urls.Add(story.GetAttribute("href"));
                        }
                        var    DistinctList = urls.Distinct();
                        string extra        = "";
                        string metadata     = "";
                        reporter.Add(new Act("Got <b>" + DistinctList.Count() + "</b> Stories"));
                        foreach (string url in DistinctList)
                        {
                            IList <IWebElement> StoryHeader = null;
                            IList <IWebElement> Story       = null;
                            Selenide.NavigateTo(driver, url);

                            string totalstory = "";
                            Dictionary <string, string> tempdict = new Dictionary <string, string>();
                            try
                            {
                                if (url.Contains("money.cnn"))
                                {
                                    if (driver.FindElementsByXPath("//h1[@class='article-title speakable']").Count > 0)
                                    {
                                        StoryHeader = driver.FindElementsByXPath("//h1[@class='article-title speakable']");
                                        IWebElement SecndaryHeader = driver.FindElementByXPath("//h2[@class='speakable']");
                                        extra    = SecndaryHeader.Text;
                                        metadata = driver.FindElementByXPath("//span[@class='cnnbyline ']").Text;
                                        Story    = driver.FindElementsByXPath("//div[@id='storytext']//p");
                                    }
                                    else
                                    {
                                        reporter.Add(new Act("Identified schemes not avialable for this type of url " + url));
                                    }
                                }
                                else
                                {
                                    if (driver.FindElementsByXPath(Util.GetLocator("storyHeader_CNN").Location).Count > 0)
                                    {
                                        StoryHeader = driver.FindElementsByXPath(Util.GetLocator("storyHeader_CNN").Location);
                                        Story       = driver.FindElementsByXPath(Util.GetLocator("Story_CNN").Location);

                                        if (driver.FindElementsByXPath(Util.GetLocator("storyHeaderMeta_CNN").Location).Count > 0)
                                        {
                                            metadata = driver.FindElementByXPath(Util.GetLocator("storyHeaderMeta_CNN").Location).Text;
                                        }
                                    }
                                    else
                                    {
                                        reporter.Add(new Act("Identified schemes not avialable for this type of url " + url));
                                    }
                                }

                                for (int i = 0; i < Story.Count; i++)
                                {
                                    totalstory += Story[i].Text;
                                }
                            }
                            catch (Exception e)
                            {
                                reporter.Add(new Act("Url doesnot fit current scheme " + url));
                                continue;
                            }
                            tempdict.Add(StoryHeader[0].Text + metadata + extra, totalstory);

                            data.Add(tempdict);
                        }
                    }
                }
                else if (sitename.ToLower().Contains("infowars"))
                {
                    IList <IWebElement> Stories = driver.FindElementsByXPath(Util.GetLocator("StoryCount_INF").Location);

                    if (Stories.Count > 2)
                    {
                        //tring to get all urls in one go
                        foreach (IWebElement story in Stories)
                        {
                            urls.Add(story.GetAttribute("href"));
                        }
                        var DistinctList = urls.Distinct();
                        reporter.Add(new Act("Got <b>" + DistinctList.Count() + "</b> Stories"));
                        foreach (string url in DistinctList)
                        {
                            Selenide.NavigateTo(driver, url);

                            IList <IWebElement> StoryHeader = driver.FindElementsByXPath(Util.GetLocator("storyHeader_INF").Location);
                            IList <IWebElement> Story       = driver.FindElementsByXPath(Util.GetLocator("Story_INF").Location);

                            Dictionary <string, string> tempdict = new Dictionary <string, string>();
                            for (int i = 0; i < StoryHeader.Count; i++)
                            {
                                tempdict.Add(StoryHeader[i].Text, Story[i].Text);
                            }

                            data.Add(tempdict);
                        }
                    }
                }
                else if (sitename.ToLower().Contains("nytimes"))
                {
                    int k = 0;
                    try
                    {
                        IList <IWebElement> Stories = driver.FindElementsByXPath(Util.GetLocator("StoryCount_NYT").Location);

                        if (Stories.Count > 2)
                        {
                            //tring to get all urls in one go
                            foreach (IWebElement story in Stories)
                            {
                                urls.Add(story.GetAttribute("href"));
                            }
                            var DistinctList = urls.Distinct();
                            reporter.Add(new Act("Got <b>" + DistinctList.Count() + "</b> Stories"));
                            foreach (string url in DistinctList)
                            {
                                if (url.StartsWith("https://www.nytimes.com/"))
                                {
                                    Selenide.NavigateTo(driver, url);

                                    k++;
                                    Dictionary <string, string> tempdict = new Dictionary <string, string>();
                                    try
                                    {
                                        if (driver.FindElementsByXPath(Util.GetLocator("storyHeader_NYT").Location).Count > 0)
                                        {
                                            IList <IWebElement> StoryHeader = driver.FindElementsByXPath(Util.GetLocator("storyHeader_NYT").Location);
                                            IList <IWebElement> Story       = driver.FindElementsByXPath(Util.GetLocator("Story_NYT").Location);
                                            string metadata = "";
                                            if (driver.FindElementsByXPath(Util.GetLocator("storyHeaderMeta_NYT").Location).Count > 0)
                                            {
                                                metadata = driver.FindElementByXPath(Util.GetLocator("storyHeaderMeta_NYT").Location).Text;
                                            }
                                            string totalstory = "";

                                            string storyheader = StoryHeader[0].Text;
                                            for (int i = 0; i < Story.Count; i++)
                                            {
                                                new Actions(driver).MoveToElement(Story[i]).Perform();
                                                Selenide.Wait(driver, 1, true);
                                                totalstory += Story[i].Text;
                                            }
                                            tempdict.Add(storyheader + metadata, totalstory);
                                        }
                                    }
                                    catch (Exception e)
                                    {
                                        continue;
                                    }

                                    data.Add(tempdict);
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                    }
                }
                else if (sitename.ToLower().Contains("breitbart"))
                {
                    int k = 0;
                    try
                    {
                        IList <IWebElement> Stories = driver.FindElementsByXPath(Util.GetLocator("StoryCount_BB").Location);

                        if (Stories.Count > 2)
                        {
                            //tring to get all urls in one go
                            foreach (IWebElement story in Stories)
                            {
                                urls.Add(story.GetAttribute("href"));
                            }
                            var DistinctList = urls.Distinct();
                            reporter.Add(new Act("Got <b>" + DistinctList.Count() + "</b> Stories"));
                            foreach (string url in DistinctList)
                            {
                                if (url.StartsWith("http://www.breitbart.com/"))
                                {
                                    Selenide.NavigateTo(driver, url);

                                    k++;
                                    Dictionary <string, string> tempdict = new Dictionary <string, string>();
                                    try
                                    {
                                        if (driver.FindElementsByXPath(Util.GetLocator("storyHeader_BB").Location).Count > 0)
                                        {
                                            IList <IWebElement> StoryHeader = driver.FindElementsByXPath(Util.GetLocator("storyHeader_BB").Location);
                                            IList <IWebElement> Story       = driver.FindElementsByClassName(Util.GetLocator("Story_BB").Location);
                                            string metadata = "";
                                            if (driver.FindElementsByXPath(Util.GetLocator("storyHeaderMeta_BB").Location).Count > 0)
                                            {
                                                metadata = driver.FindElementByXPath(Util.GetLocator("storyHeaderMeta_BB").Location).Text;
                                            }
                                            string totalstory = "";

                                            string storyheader = StoryHeader[0].Text;

                                            IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                                            try
                                            {
                                                totalstory = (string)js.ExecuteScript("return document.getElementsByClassName('" + Util.GetLocator("Story_BB").Location + "')[0].innerText;");
                                            }
                                            catch
                                            {
                                                for (int i = 0; i < Story.Count; i++)
                                                {
                                                    new Actions(driver).MoveToElement(Story[i]).Perform();
                                                    Selenide.Wait(driver, 1, true);
                                                    totalstory += Story[i].Text;
                                                }
                                            }



                                            tempdict.Add(storyheader + metadata, totalstory);
                                        }
                                    }
                                    catch (Exception e)
                                    {
                                        continue;
                                    }

                                    data.Add(tempdict);
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                    }
                }
                else if (sitename.ToLower().Contains("huffingtonpost"))
                {
                    int k = 1;
                    try
                    {
                        try
                        {
                            IList <IWebElement> Stories = driver.FindElementsByXPath(Util.GetLocator("StoryCount_HFP").Location);

                            if (Stories.Count > 2)
                            {
                                //tring to get all urls in one go
                                foreach (IWebElement story in Stories)
                                {
                                    urls.Add(story.GetAttribute("href"));
                                }
                                var DistinctList = urls.Distinct();

                                reporter.Add(new Act("Got <b>" + DistinctList.Count() + "</b> Stories"));
                                foreach (string url in DistinctList)
                                {
                                    if (url.StartsWith("https://www.huffingtonpost.com/entry/"))
                                    {
                                        Selenide.NavigateTo(driver, url);

                                        Dictionary <string, string> tempdict = new Dictionary <string, string>();
                                        try
                                        {
                                            if (Selenide.Query.isElementVisibleboolValue(driver, Util.GetLocator("Story_HFP"), false))
                                            {
                                                IList <IWebElement> StoryHeader = driver.FindElementsByXPath(Util.GetLocator("storyHeader_HFP").Location);
                                                IList <IWebElement> Story       = driver.FindElementsById(Util.GetLocator("Story_HFP").Location);
                                                string metadata = "";
                                                try
                                                {
                                                    if (Selenide.Query.isElementVisibleboolValue(driver, Util.GetLocator("storyHeaderMeta_HFP"), false))
                                                    {
                                                        metadata = driver.FindElementByXPath(Util.GetLocator("storyHeaderMeta_HFP").Location).Text;
                                                    }
                                                }
                                                catch (Exception e)
                                                {
                                                }
                                                string totalstory = "";

                                                string storyheader = StoryHeader[0].Text;

                                                IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                                                try
                                                {
                                                    totalstory = (string)js.ExecuteScript("return document.getElementsByClassName('" + Util.GetLocator("Story_HFP_cn").Location + "')[0].innerText;");
                                                    tempdict.Add(storyheader + metadata, totalstory);
                                                }
                                                catch
                                                {
                                                    for (int i = 0; i < Story.Count; i++)
                                                    {
                                                        new Actions(driver).MoveToElement(Story[i]).Perform();
                                                        Selenide.Wait(driver, 1, true);
                                                        totalstory += Story[i].Text;
                                                    }
                                                    tempdict.Add(storyheader + metadata, totalstory);
                                                }

                                                data.Add(tempdict);
                                            }
                                            else
                                            {
                                                reporter.Add(new Act("Current url is not working for the known scheme ::" + url));
                                            }
                                        }
                                        catch (Exception e)
                                        {
                                            continue;
                                        }
                                    }

                                    else
                                    {
                                        List <string> ParentUrls = new List <string>();
                                        Selenide.NavigateTo(driver, url);
                                        IList <IWebElement> Stories2 = driver.FindElementsByXPath(Util.GetLocator("StoryCount_HFP").Location);

                                        if (Stories.Count > 2)
                                        {
                                            //tring to get all urls in one go
                                            foreach (IWebElement story1 in Stories2)
                                            {
                                                ParentUrls.Add(story1.GetAttribute("href"));
                                            }
                                            var DistinctList2 = ParentUrls.Distinct();

                                            reporter.Add(new Act("Looking into <b>" + DistinctList.Count() + "</b> Stories"));

                                            foreach (string url2 in DistinctList2)
                                            {
                                                if (url2.StartsWith("https://www.huffingtonpost.com/entry/"))
                                                {
                                                    Selenide.NavigateTo(driver, url2);

                                                    Dictionary <string, string> tempdict2 = new Dictionary <string, string>();
                                                    try
                                                    {
                                                        if (Selenide.Query.isElementVisibleboolValue(driver, Util.GetLocator("Story_HFP"), false))
                                                        {
                                                            IList <IWebElement> StoryHeader2 = driver.FindElementsByXPath(Util.GetLocator("storyHeader_HFP").Location);
                                                            IList <IWebElement> Story2       = driver.FindElementsById(Util.GetLocator("Story_HFP").Location);
                                                            string metadata = "";
                                                            try
                                                            {
                                                                if (Selenide.Query.isElementVisibleboolValue(driver, Util.GetLocator("storyHeaderMeta_HFP"), false))
                                                                {
                                                                    metadata = driver.FindElementByXPath(Util.GetLocator("storyHeaderMeta_HFP").Location).Text;
                                                                }
                                                            }
                                                            catch (Exception e)
                                                            {
                                                            }
                                                            string totalstory = "";

                                                            string storyheader = StoryHeader2[0].Text;

                                                            IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                                                            try
                                                            {
                                                                totalstory = (string)js.ExecuteScript("return document.getElementsByClassName('" + Util.GetLocator("Story_HFP_cn").Location + "')[0].innerText;");
                                                                tempdict2.Add(storyheader + metadata, totalstory);
                                                            }
                                                            catch
                                                            {
                                                                for (int i = 0; i < Story2.Count; i++)
                                                                {
                                                                    new Actions(driver).MoveToElement(Story2[i]).Perform();
                                                                    Selenide.Wait(driver, 1, true);
                                                                    totalstory += Story2[i].Text;
                                                                }
                                                                tempdict2.Add(storyheader + metadata, totalstory);
                                                            }

                                                            data.Add(tempdict2);
                                                        }
                                                        else
                                                        {
                                                            reporter.Add(new Act("Current url is not working for the known scheme ::" + url2));
                                                        }
                                                    }
                                                    catch (Exception e)
                                                    {
                                                        continue;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            k++;
                            Selenide.NavigateTo(driver, sitename);
                            if (Selenide.Query.isElementExist(driver, Locator.Get(LocatorType.XPath, "//*[@id='pagination']/div[2]//a[contains(@href,'?page=2')]"), false))
                            {
                                try
                                {
                                    driver.FindElementByXPath("//*[@id='pagination']/div[2]//a[contains(@href,'?page=2')]").Click();
                                }
                                catch (Exception e)
                                {
                                    reporter.Add(new Act("Click never happened for page ::" + k));
                                }
                            }
                        }
                        catch (Exception e)
                        {
                        }
                    }
                    catch (Exception e)
                    {
                    }
                }
            }


            catch (Exception e)
            {
            }
            return(data);
        }