public void Datafeed(IWebDriver driver, Datarow datarow) { try { driver.Navigate().GoToUrl("https://qaadmin.mobankdev.com"); driver.FindElement(By.LinkText("MoShop")).Click(); driver.FindElement(By.CssSelector("#IndexMenuLeaf3 > a")).Click(); driver.FindElement(By.LinkText("testshop")).Click(); driver.FindElement(By.LinkText("Shop")).Click(); decimal count = driver.FindElements(By.XPath("//div[@id='CataloguesControl']/div/table/tbody/tr")).Count; for (var i = 1; i <= count; i++) { var j = count; if (i == 1) { driver.FindElement(By.Id("Catalogues_" + j + "__Name")).Clear(); driver.FindElement(By.Id("Catalogues_" + j + "__Name")).SendKeys("Datafeed"); driver.FindElement(By.Id("Catalogues_" + j + "__Name")).SendKeys(Keys.Enter); driver.FindElement(By.CssSelector("input.button")).Click(); } var name = GetValue(driver, By.XPath("//div[@id='CataloguesControl']/div/table/tbody/tr[" + i + "]/td/input"), 30); if (name != "Datafeed") continue; driver.FindElement( By.XPath("//div[@id='CataloguesControl']/div/table/tbody/tr[" + i + "]/th/input[4]")) .Click(); driver.FindElement(By.CssSelector("input.button")).Click(); if ( driver.FindElement( By.XPath("//div[@id='CataloguesControl']/div/table/tbody/tr[" + i + "]/th/input[4]")) .Enabled) { datarow.Newrow("Datafeed Catalogue Selection", "Datafeed Catalogue is expected to be selected", "Datafeed Catalogue is selected", "PASS", driver); } else { driver.FindElement(By.XPath("//div[@id='CataloguesControl']/div/table/tbody/tr/th/input[4]")) .Click(); driver.FindElement(By.CssSelector("input.button")).Click(); } driver.FindElement( By.XPath("//div[@id='CataloguesControl']/div/table/tbody/tr[" + i + "]/th[2]/a")).Click(); break; } driver.FindElement(By.Id("File")) .SendKeys( @"C:\Users\teja\Documents\GitHub\PlatformAutomationTestFramework\SeleniumTestFrameWork\MoShop\Shop Config\Catalogue XML's\TickleTest_WithProductGroups.xml"); driver.FindElement(By.CssSelector("div.box > p.right > input.button")).Click(); var title = driver.Title; var run = new RunScrape(); run.Scarperead(driver, datarow, title); } catch (Exception ex) { var e = ex.ToString(); datarow.Newrow("Exception", "Exception Not Expected", e, "FAIL"); } }
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(); } }