public void UpdatedListing() { manageListing.Click(); //Populate data from Excel GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "SkillShare"); SkillSharePage updSkillObj = new SkillSharePage(); WebDriverWait wait1 = new WebDriverWait(Global.GlobalDefinitions.driver, TimeSpan.FromSeconds(100)); IWebElement element1 = wait1.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//h2[contains(text(),'Manage Listings')]"))); while (true) { for (int j = 1; j <= 5; j++) { Thread.Sleep(1000); var titleObj = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[3]")).Text; var categoryObj = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[2]")).Text; IWebElement updateListing = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[8]/i[2]")); Global.GlobalDefinitions.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(60); if (titleObj == "testing" && categoryObj == "Programming & Tech") { Global.GlobalDefinitions.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(60); updateListing.Click(); Global.GlobalDefinitions.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(60); updSkillObj.SkillShare(); Base.Test.Log(LogStatus.Info, "Skill Updated"); return; } } //click next page nextPageBtn.Click(); } }
public void UpdatedListing() { manageListing.Click(); //Populate data from Excel GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "SkillShare"); SkillSharePage updSkillObj = new SkillSharePage(); //wait for manage listing GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//h2[contains(text(),'Manage Listings')]"), 10); while (true) { for (int j = 1; j <= 5; j++) { GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//tr[1]//td[3]"), 10); var categoryObj = Global.GlobalDefinitions.driver.FindElement(By.XPath("//tr[" + j + "]//td[2]")).Text; var titleObj = GlobalDefinitions.driver.FindElement(By.XPath("//tr[" + j + "]//td[3]")).Text; IWebElement updateListing = GlobalDefinitions.driver.FindElement(By.XPath("//tr[" + j + "]//td[8]//i[2]")); GlobalDefinitions.wait(10); if (titleObj == "ttt" && categoryObj == "Programming & Tech") { //wait for update btn GlobalDefinitions.waitUntilClickable(GlobalDefinitions.driver, 1000, "(//tr[" + j + "]//td[8]//i[2])", "XPath"); updateListing.Click(); GlobalDefinitions.wait(10); updSkillObj.SkillShare(); Base.Test.Log(LogStatus.Pass, "Skill updated successfully, Test passed"); return; } } //click next page nextPageBtn.Click(); } }
//try //{ // while (true) // { // for (int j = 1; j <= 5; j++) // { // var titleObj = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[3]")).Text; // Global.GlobalDefinitions.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20); // var categoryObj = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[2]")).Text; // IWebElement deleteListing = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + " ]/td[8]/i[3]")); // Global.GlobalDefinitions.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20); // if (titleObj == GlobalDefinitions.ExcelLib.ReadData(2, "Title") && categoryObj == "Writing & Translation") // { // //Global.Base.Test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skill Delete failed"); // continue; // } // // } // //click next page // nextPageBtn.Click(); // } //} //catch (Exception e) //{ // Global.Base.Test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skill deleted successfully"); //} public void UpdatedListing() { manageListing.Click(); //Populate data from Excel GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "SkillShare"); SkillSharePage updSkillObj = new SkillSharePage(); WebDriverWait manageListingWait = new WebDriverWait(Global.GlobalDefinitions.driver, TimeSpan.FromSeconds(20)); IWebElement manageListingObj = manageListingWait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath("//h2[contains(text(),'Manage Listings')]"))); // IList<IWebElement> noOfPages = Global.GlobalDefinitions.driver.FindElements(By.XPath("//table[@class='ui striped table']//div[@class='ui buttons semantic-ui-react-button-pagination']//button[@role = 'button']")); // Thread.Sleep(1000); // for (int i = 1; i <= noOfPages.Count; i++) // { // Global.GlobalDefinitions.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); // for (int j = 1; j <= 5; j++) // { // var titleObj = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[3]")).Text; // Global.GlobalDefinitions.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); // var categoryObj = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[2]")).Text; // Global.GlobalDefinitions.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); // IWebElement updateListing = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[8]/i[2]")); // Global.GlobalDefinitions.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); // if (titleObj == "testing" && categoryObj == "Programming & Tech") // { // updateListing.Click(); // Global.GlobalDefinitions.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); // updSkillObj.SkillShare(); // Global.Base.Test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skill updated Successfully"); // return; // } // } // //click next page // nextPageBtn.Click(); // } //} //IList<IWebElement> noOfPages = Global.GlobalDefinitions.driver.FindElements(By.XPath("//div[@class='ui buttons semantic-ui-react-button-pagination']")); IList <IWebElement> noOfPages = Global.GlobalDefinitions.driver.FindElements(By.XPath("//button[@class='ui button otherPage']")); for (int i = 0; i <= noOfPages.Count; i++) { for (int j = 1; j <= 5; j++) { Global.GlobalDefinitions.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); var titleObj = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[3]")).Text; var categoryObj = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[2]")).Text; IWebElement updateListing = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[8]/i[2]")); Global.GlobalDefinitions.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); if (titleObj == "testing" && categoryObj == "Programming & Tech") { //Global.GlobalDefinitions.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); updateListing.Click(); Global.GlobalDefinitions.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); updSkillObj.SkillShare(); Base.Test.Log(LogStatus.Info, "Skill Updated"); return; } } //click next page nextPageBtn.Click(); } }