public void Finally(IWebDriver driver, string url, Datarow datarow, string emails)
        {
            new GeneralLibrary();
            try
            {
                //Footer_TPS footer = new Footer_TPS();
                //footer.Footer(driver, , url, datarow);

                //Baskets_TPS basket = new Baskets_TPS();
                //basket.Basket(driver, datarow);

                //links_TPS hom = new links_TPS();
                //hom.Links(datarow,driver, url);

                //UserJourney_TPS userjour = new UserJourney_TPS();
                //userjour.UserJourn(datarow,driver, url);

                //Mopay_TPS Mopay = new Mopay_TPS();
                //Mopay.Mopay(driver, datarow);
            }
            catch (Exception e)
            {
                Console.Write(e);
                var ex = e.ToString();
                var scree = new Screenshot();
                datarow.Newrow("Exception", "Not Expected", ex, "FAIL", driver);
                scree.Screenshotfailed(driver);
            }
            finally
            {
                var split = url.Split(new[] {' ', ',', '.', '/', '\t'});

                foreach (var sr in split)
                {
                    if (split[2] == "m" || split[2] == "www")
                    {
                        if (sr != split[3]) continue;
                        datarow.consolidatedreport(emails);
                        datarow.Excelsave("Mosite-" + sr + "", driver, emails);

                        driver.Quit();
                        break;
                    }
                    if (sr != split[2]) continue;
                    datarow.consolidatedreport(emails);
                    datarow.Excelsave("Mosite-" + sr + "", driver, emails);

                    driver.Quit();
                    break;
                }
            }
        }
        public void Mosite(IWebDriver driver, Datarow datarow, string urls, string items)
        {
            var screenshot = new Screenshot();

            var strArray = items.Split(new[] {','});
            var urlarray = urls.Split(new[] {','});
            try
            {
                foreach (var url in urlarray)
                {
                    foreach (var str in strArray.Where(str => str != null))
                    {
                        if (str == "Test All Links in Mosite")
                        {
                            datarow.Newrow("", "", "Test All Links in Mosite", "", driver);
                            var tick = new Tickle();
                            tick.HomepageTabsTickle(datarow, driver, url);
                        }

                        if (str == "Test Footer Links")
                        {
                            datarow.Newrow("", "", "Test Footer Links", "", driver);
                        }
                        if (str == "Test Basket Functionality")
                        {
                            datarow.Newrow("", "", "Test Basket Functionality", "", driver);
                        }
                        if (str == "Test Produict Page - Test Add Product to Basket")
                        {
                            datarow.Newrow("", "", "Test Produict Page - Test Add Product to Basket", "", driver);
                        }
                        if (str == "Test Delete From Basket - Test Product Unavailable")
                        {
                            datarow.Newrow("", "", "Test Delete From Basket - Test Product Unavailable", "", driver);
                        }
                        if (str == "Test Registration/Login - CheckOut Pages")
                        {
                            datarow.Newrow("", "", "Test Registration/Login - CheckOut Pages", "", driver);
                        }
                        if (str == "Test Mopay")
                        {
                            datarow.Newrow("", "", "Test Mopay", "", driver);
                        }
                    }
                }
            }
            catch (Exception)
            {
                datarow.Newrow("Exception", "", "Exception Not Expected", "FAIL", driver);
                screenshot.Screenshotfailed(driver);
            }
            finally
            {
                datarow.Excelsave("MoshopConsole", driver, "*****@*****.**");
                screenshot.Screenshotfailed(driver);
                driver.Quit();
            }
        }
        public void Batchtesting(string items, string url, IWebDriver driver, Datarow datarow)
        {
            try
            {
                new BlobStorage();
                // blob.Blob(driver,datarow, url);

                //string[] vesion = verson.Split(',');

                //foreach (string vsion in vesion)
                //{
                //    public const string version = vsion;
                //}

                var selectedvalue = items.Split(',');
                var i = 0;
                foreach (var function in selectedvalue)
                {
                    if (function == "Search")
                    {
                        datarow.Newrow("", "", "Search", "", driver);
                        new Searchsort().Search(driver);
                    }
                    if (function == "Test All Links in Mosite")
                    {
                        datarow.Newrow("", "", "All Links in Mosite - Validations", "", driver);
                        var hom = new LinksTps();
                        hom.Links(datarow, driver, url);
                        i++;
                    }
                    if (function == "Test Footer Links")
                    {
                        datarow.Newrow("", "", "Footer Links", "", driver);
                        var footer = new FooterTps();
                        footer.Footerhome(driver, url, datarow);
                        i++;
                    }
                    if (function == "Test Basket Functionality")
                    {
                        datarow.Newrow("", "", "Basket Functionality", "", driver);
                        var basket = new BasketsTps();
                        basket.Basket(driver, datarow, url);
                        i++;
                    }
                    if (function == "Test Product page - Test Add Product to Basket")
                    {
                        datarow.Newrow("", "", "User Journey", "", driver);
                        var userjour = new UserJourneyTps();
                        userjour.UserJourn(datarow, driver, url);
                        i++;
                    }
                    if (function == "Test Delete From Basket - Test product Unavailable")
                    {
                        datarow.Newrow("", "", "Delete From Basket", "", driver);
                        var delete = new Deletebasketstart();
                        delete.Deletebasstart(driver, datarow);
                        i++;
                    }

                    if (function == "Custom Checkout")
                    {
                        var ckout = new BatchCheckout();
                        ckout.Checkout(driver, url, datarow);
                    }

                    if (function == "Test Registration/Login - CheckOut Pages")
                    {
                        datarow.Newrow("", "", "Registration/Login", "", driver);
                        var login = new LoginRegistration();
                        login.Registration(driver, datarow);
                        i++;
                    }

                    if (function != "Test Mopay") continue;
                    try
                    {
                        datarow.Newrow("", "", "Mopay", "", driver);
                        var pay = new BatchPay();
                        pay.Batchpay(driver, url, datarow);
                    }
                    catch (Exception)
                    {
                        datarow.Newrow("Exception", "", "Exception Not Expected", "FAIL", driver);
                        _screenshot.Screenshotfailed(driver);
                    }

                    i++;
                }
            }
            catch (Exception)
            {
                datarow.Newrow("Exception", "", "Exception Not Expected", "FAIL", driver);
                _screenshot.Screenshotfailed(driver);
            }

            finally
            {
                datarow.Excelsave("Mosite", driver, "*****@*****.**");
                _screenshot.Screenshotfailed(driver);
                driver.Quit();
            }
        }
        public void Acctabs(IWebDriver driver, Datarow datarow)
        {
            driver.Navigate().GoToUrl("https://devpay.mobankdev.com/Management");
            try
            {
                string str;
                driver.FindElement(By.CssSelector("#IndexMenu > ul > li.selected > ul > li > a")).Click();

                if (driver.PageSource.Contains("Test Client Account"))
                {
                    driver.FindElement(By.LinkText("Test Client Account")).Click();
                    datarow.Newrow("Test Client Tab", "Test Client Tab", "Test Client Account", "PASS", driver);
                }
                if (driver.PageSource.Contains("Test Client Account"))
                {
                    driver.FindElement(By.LinkText("Test Client Account")).Click();
                    datarow.Newrow("Test Client Tab", "Test Client Tab", "Test Client Account", "PASS", driver);
                }
                else
                {
                    str = "Test Client Account TabNot Present";
                    datarow.Newrow("Test Client Account Link", str, "Test Client Account Link", "FAIL", driver);
                    _screenshot.Screenshotfailed(driver);
                    driver.Navigate().GoToUrl("https://devpay.mobankdev.com/Management/Accounts/Update/1");
                }
                var actual = driver.Title;
                if (actual == "Details : mopowered.co.uk")
                {
                    datarow.Newrow("Details Tab", "Details : mopowered.co.uk", actual, "PASS", driver);
                }
                else
                {
                    datarow.Newrow("Details Tab", "Details : mopowered.co.uk", actual, "FAIL", driver);
                    _screenshot.Screenshotfailed(driver);
                    driver.Navigate().GoToUrl("https://devpay.mobankdev.com/Management/Accounts/Update/1");
                }
                if (driver.PageSource.Contains("Payment Provider"))
                {
                    driver.FindElement(By.LinkText("Payment Provider")).Click();
                    datarow.Newrow("Payment Provider Tab", "Payment Provider Tab", "Payment Provider", "PASS", driver
                        );
                }
                else
                {
                    str = "Payment Provider TabNot Present";
                    datarow.Newrow("Payment Provider Link", str, "Payment Provider Link", "FAIL", driver);
                    _screenshot.Screenshotfailed(driver);
                    driver.Navigate().GoToUrl("https://devpay.mobankdev.com/Management/Accounts/Update/1");
                }

                var str3 = driver.Title;
                if (str3 == "Payment Provider : mopowered.co.uk")
                {
                    datarow.Newrow("Payment Provider Tab", "Payment Provider : mopowered.co.uk", str3, "PASS", driver
                        );
                    new Paymentprovider().Provider(driver, datarow);
                }
                else
                {
                    datarow.Newrow("Payment Provider Tab", "Payment Provider : mopowered.co.uk", str3, "FAIL", driver
                        );
                    _screenshot.Screenshotfailed(driver);
                    driver.Navigate().GoToUrl("https://devpay.mobankdev.com/Management/Accounts/Update/1");
                }
                if (driver.PageSource.Contains("Notifications"))
                {
                    driver.FindElement(By.LinkText("Notifications")).Click();
                    datarow.Newrow("Notifications Tab", "Notifications Tab", "Notifications", "PASS", driver);
                    new Notificationtab().Notifications(driver, datarow);
                }
                else
                {
                    datarow.Newrow("Notifications Link", "Notifications TabNot Present", "Notifications Link", "FAIL",
                                   driver);
                    _screenshot.Screenshotfailed(driver);
                    driver.Navigate().GoToUrl("https://devpay.mobankdev.com/Management/Accounts/Update/1");
                }

                var str4 = driver.Title;
                if (str4 == "Notifications : mopowered.co.uk")
                {
                    datarow.Newrow("Notifications Tab", "Notifications : mopowered.co.uk", str4, "PASS", driver
                        );
                }
                else
                {
                    datarow.Newrow("Notifications Tab", "Notifications : mopowered.co.uk", str4, "FAIL", driver
                        );
                    _screenshot.Screenshotfailed(driver);
                    driver.Navigate().GoToUrl("https://devpay.mobankdev.com/Management/Accounts/Update/1");
                }
                Thread.Sleep(0x1388);
                if (driver.PageSource.Contains("Transactions"))
                {
                    driver.FindElement(By.LinkText("Transactions")).Click();
                    datarow.Newrow("Transactions Tab", "Transactions Tab", "Transactions", "PASS", driver);
                }
                else
                {
                    str = "Transactions TabNot Present";
                    datarow.Newrow("Transactions Link", str, "Transactions Link", "FAIL", driver);
                    _screenshot.Screenshotfailed(driver);
                    driver.Navigate().GoToUrl("https://devpay.mobankdev.com/Management/Accounts/Update/1");
                }

                var str5 = driver.Title;
                if (str5 == "Transactions : mopowered.co.uk")
                {
                    datarow.Newrow("Transactions Tab", "Transactions : mopowered.co.uk", str5, "PASS", driver);
                }
                else
                {
                    datarow.Newrow("Transactions Tab", "Transactions : mopowered.co.uk", str5, "FAIL", driver);
                    _screenshot.Screenshotfailed(driver);
                    driver.Navigate().GoToUrl("https://devpay.mobankdev.com/Management/Accounts/Update/1");
                }
                if (driver.PageSource.Contains("History"))
                {
                    driver.FindElement(By.LinkText("History")).Click();
                    datarow.Newrow("History Tab", "History Tab", "History", "PASS", driver);
                }
                else
                {
                    str = "History TabNot Present";
                    datarow.Newrow("History Link", str, "History Link", "FAIL", driver);
                    _screenshot.Screenshotfailed(driver);
                    driver.Navigate().GoToUrl("https://devpay.mobankdev.com/Management/Accounts/Update/1");
                }

                var str6 = driver.Title;
                if (str6 == "History : mopowered.co.uk")
                {
                    datarow.Newrow("History Tab", "History : mopowered.co.uk", str6, "PASS", driver);
                }
                else
                {
                    datarow.Newrow("History Tab", "History : mopowered.co.uk", str6, "FAIL", driver);
                    _screenshot.Screenshotfailed(driver);
                    driver.Navigate().GoToUrl("https://devpay.mobankdev.com/Management/Accounts/Update/1");
                }
                driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10.0));
                driver.FindElement(By.LinkText("Payment Provider"));
                driver.FindElement(By.LinkText("Payment Provider")).Click();

                var str7 = driver.Title;
                if (str7 == "Payment Provider : mopowered.co.uk")
                {
                    datarow.Newrow("Payment Provider Tab", "Payment Provider : mopowered.co.uk", str7, "PASS", driver
                        );
                }
                else
                {
                    datarow.Newrow("Payment Provider Tab", "Payment Provider : mopowered.co.uk", str7, "FAIL", driver
                        );
                    _screenshot.Screenshotfailed(driver);
                }
                if (driver.PageSource.Contains("…"))
                {
                    driver.FindElement(By.LinkText("…")).Click();

                    datarow.Newrow("Update Tab", "Update Tab", "Update", "PASS", driver);
                }
                else
                {
                    str = "Update TabNot Present";
                    datarow.Newrow("Update Link", str, "Update Link", "FAIL", driver);
                    _screenshot.Screenshotfailed(driver);
                    driver.Navigate().GoToUrl("https://devpay.mobankdev.com/Management/Accounts/Update/1");
                }
                var str8 = driver.Title;
                if (str8 == "Update : mopowered.co.uk")
                {
                    datarow.Newrow("Update Tab", "Update : mopowered.co.uk", str8, "PASS", driver);
                }
                else
                {
                    datarow.Newrow("Update Tab", "Update : mopowered.co.uk", str8, "FAIL", driver);
                    _screenshot.Screenshotfailed(driver);
                }

                var str9 = driver.Title;
                if (str9 == "Update : mopowered.co.uk")
                {
                    datarow.Newrow("Update Tab", "Update : mopowered.co.uk", str9, "PASS", driver);
                }
                else
                {
                    datarow.Newrow("Update Tab", "Update : mopowered.co.uk", str9, "FAIL", driver);
                    _screenshot.Screenshotfailed(driver);
                }
                driver.Navigate().GoToUrl("https://devpay.mobankdev.com/Management");

                if (driver.PageSource.Contains("Users"))
                {
                    driver.FindElement(By.LinkText("Users")).Click();
                    datarow.Newrow("Users Tab", "Users Tab", "Users", "PASS", driver);
                }
                else
                {
                    str = "Users TabNot Present";
                    datarow.Newrow("Users Link", str, "Users Link", "FAIL", driver);
                    _screenshot.Screenshotfailed(driver);
                    driver.Navigate().GoToUrl("https://devpay.mobankdev.com/Management/Accounts/Update/1");
                }

                var str10 = driver.Title;
                if (str10 == "Users : mopowered.co.uk")
                {
                    datarow.Newrow("Users Tab", "Users : mopowered.co.uk", str10, "PASS", driver);
                }
                else
                {
                    datarow.Newrow("Users Tab", "Users : mopowered.co.uk", str10, "FAIL", driver);
                    _screenshot.Screenshotfailed(driver);
                    driver.Navigate().GoToUrl("https://devpay.mobankdev.com/Management/Accounts/Update/1");
                }
            }
            catch (Exception exception)
            {
                var str11 = exception.ToString();
                Console.Write(exception);
                datarow.Newrow("Exception", "Exception Not Expected", str11, "FAIL", driver);
            }
            finally
            {
                _screenshot.Screenshotfailed(driver);
                datarow.Excelsave("MopayConsole", driver, "*****@*****.**");
                driver.Quit();
            }
        }
        public void Batchmoshop(IWebDriver driver, Datarow datarow, string items, string vers)
        {
            var screenshot = new Screenshot();
            try
            {
                var moshop = new MoShopConsole();
                moshop.Homepagetabs(driver, datarow);
                driver.Manage().Window.Maximize();

                var strArray = items.Split(new[] {','});

                foreach (var str in strArray.Where(str => str.Length != 0))
                {
                    #region Test Shop

                    if (str == "Create a Test Shop")
                    {
                        datarow.Newrow("", "", "Create a Test Shop", "", driver);
                        var testshop = new CreateShop();
                        testshop.Testshop(driver, datarow);

                        new LookandFeel().Lookandfeel(driver, datarow);

                        #region Global Settings

                        new GlobalSetting();
                        // global.globalsetting(driver);

                        #endregion
                    }

                    #endregion

                    #region Test Scrape

                    if (str == "Create a Test Scrape")
                    {
                        datarow.Newrow("", "", "Create a Test Scarpe", "", driver);
                        new Createscrape().CreateScrape(driver, datarow);
                    }

                    #endregion

                    #region Run Manual Scrape

                    if (str == "Run Manual Scrape")
                    {
                        datarow.Newrow("", "", "Run Manual Scrape", "", driver);
                        var run = new RunScrape();
                        run.Runscrape(driver, datarow);
                    }

                    #endregion

                    #region Custom Domain Name Feature and Localisation

                    if (str == "Validate Custom Domain Name Feature and Localisation")
                    {
                        datarow.Newrow("", "", "Validate Custom domain Name", "", driver);
                        new Shop().Culture(driver, datarow);
                    }

                    #endregion

                    #region "Run the Test Site - Scrape

                    if (str == "Run the Test Site - Scrape")
                    {
                        try
                        {
                            driver.Manage().Window.Size = new Size(400, 550);
                            datarow.Newrow("", "", "Run the Test Site", "", driver);
                            driver.Navigate().GoToUrl("http://testshop.mobankdev.com/");

                            new BlobStorage();
                            //blob.Blob(driver,datarow, "http://testshop.mobankdev.com/");
                            commtest(driver, datarow);
                        }
                        catch (Exception ex)
                        {
                            var e = ex.ToString();
                            datarow.Newrow("Exception", "Exception Not Expected", e, "FAIL", driver);
                        }
                    }

                    #endregion

                    #region Run the Test Site - DataFeed XML

                    if (str == "Run the Test Site - DataFeed XML")
                    {
                        var datafeed = new DatafeedXml();
                        datafeed.Datafeed(driver, datarow);
                        datarow.Newrow("", "", "Run the Test Site-DataFeed", "", driver);
                        driver.Navigate().GoToUrl("http://testshop.mobankdev.com/");

                        datarow.Newrow("", "", "Footer Links", "", driver);
                        var footer = new FooterTps();
                        footer.Footerhome(driver, "http://testshop.mobankdev.com/", datarow);
                        var relatedproduct = new RelatedProducts();
                        relatedproduct.Relatedproducts(driver, datarow);
                        //commtest(driver, datarow);
                    }

                    #endregion

                    #region Validate Products Against Live Site - Modropenia

                    if (str == "Validate Products Against Live Site - Modropenia")
                    {
                        var modrophenia = new Modrophenialive();
                        modrophenia.modrophenialiveproducts(driver);
                        var products = new Modropheniaproducts();
                        products.Product(datarow, driver);
                    }

                    #endregion

                    # region Delete Shop And Scrape

                    if (str != "Delete TestShop And TestScrape") continue;
                    var delete = new DeleteTestShop();
                    delete.Deleteshop(driver);
                    delete.Deletedscrape(driver);
        }

        #endregion Methods
    }

    catch(Exception exception)
    {
        var str2 = exception.ToString();
                datarow.Newrow("Exception", "Exception Not Expected", str2, "FAIL", driver);
                screenshot.Screenshotfailed(driver);
    }

     finally
    {
        datarow.Excelsave("MoshopConsole", driver, "*****@*****.**");
                screenshot.Screenshotfailed(driver);
                driver.Quit();
    }
}
        /*
        private Screenshot _screenshot = new Screenshot();
        */
        public void Create(IWebDriver driver)
        {
            var datarow = new Datarow();
            _genaralLibrary = new GeneralLibrary();
            var excelData = _genaralLibrary.GetExcelData(@"C:\\Input Data\CardDetails.xls", "AccountCreation");
            datarow.Col();
            var table = excelData.Tables[0];
            try
            {
                var count = table.Rows.Count;
                for (var i = 0; i <= count; i++)
                {
                    var expected = table.Rows[i]["AccountName"].ToString();
                    var text = table.Rows[i]["Provider"].ToString();
                    var str3 = table.Rows[i]["ReturnURI"].ToString();
                    if (driver.Title == "Log On : mopowered.co.uk")
                    {
                        driver.FindElement(
                            By.CssSelector(
                                "html body div#Top.page div#Content div.mainContent div#Main div#LogOnSection.section div.box form#LogOnForm.form div div#EmailControl.control div.input input#Email"))
                              .SendKeys("*****@*****.**");
                        driver.FindElement(
                            By.CssSelector(
                                "html body div#Top.page div#Content div.mainContent div#Main div#LogOnSection.section div.box form#LogOnForm.form div div#PasswordControl.control div.input input#Password"))
                              .SendKeys("Apple12345");
                        driver.FindElement(By.Id("LogOn_Action_LogOn")).Click();
                    }
                    driver.FindElement(By.XPath("//div[@id='IndexMenu']/ul/li/ul/li/a")).Click();

                    driver.FindElement(By.LinkText("Create")).Click();
                    driver.FindElement(By.Id("Name")).Clear();
                    driver.FindElement(By.Id("Name")).SendKeys(expected);
                    driver.FindElement(By.CssSelector("#IndexMenu > ul > li.selected > ul > li > a")).Click();

                    if (driver.PageSource.Contains("Test Client Account"))
                    {
                        driver.FindElement(By.LinkText("Test Client Account")).Click();
                        datarow.Newrow("Test Client Tab", "Test Client Tab", "Test Client Account", "PASS", driver
                            );
                    }
                    new SelectElement(driver.FindElement(By.Id("Provider_Id"))).SelectByText(text);
                    driver.FindElement(By.CssSelector("input.button")).Click();
                    Thread.Sleep(0x1388);
                    var attribute = driver.FindElement(By.Id("Name")).GetAttribute("Value");
                    var actual = driver.FindElement(By.Id("Provider_Id")).GetAttribute("Value");
                    datarow.Newrow("Account Name", expected, attribute, expected == attribute ? "PASS" : "FAIL", driver);
                    datarow.Newrow("Provider", text, actual, text == actual ? "PASS" : "FAIL", driver);
                    var str8 = driver.Title;
                    datarow.Newrow("Details Tab", "Details : mopowered.co.uk", str8,
                        str8 == "Details : mopowered.co.uk" ? "PASS" : "FAIL", driver);
                    driver.FindElement(By.Id("PayProviderCheckOutReturnUri")).Clear();
                    driver.FindElement(By.Id("PayProviderCheckOutReturnUri")).SendKeys(str3);
                    driver.FindElement(By.CssSelector("input.button")).Click();
                    Thread.Sleep(0x1388);
                    driver.FindElement(By.LinkText("Payment Provider")).Click();

                    new Paymentprovider().Provider(driver, datarow);
                    new Notificationtab().Notifications(driver, datarow);
                }
            }
            catch (Exception exception)
            {
                var str9 = exception.ToString();
                datarow.Newrow("Exception", "Not Expected", str9, "FAIL", driver);
                datarow.Excelsave("MoPay Account Creation", driver, "*****@*****.**");
            }
            finally
            {
                datarow.Excelsave("MoPay Account Creation", driver, "*****@*****.**");
            }
        }