public void ExtractAllFlagsInTheWorld() { var indexPage = new IndexPage(_driver); var countryPage = new CountryPage(_driver); indexPage.NavigateTo("http://flagpedia.net/index"); var countryNames = indexPage.GetNames(); foreach (var element in countryNames) { string url = "http://flagpedia.net/" + element; countryPage.NavigateTo(url); ((IJavaScriptExecutor)_driver).ExecuteScript("window.scrollTo(0, document.body.scrollHeight - 150)"); var screenshot = ((ITakesScreenshot)_driver).GetScreenshot(); screenshot.SaveAsFile(Path.GetFullPath(@"../../../Screenshots/Flags/") + countryPage.BuildName(countryPage) + ".png", ScreenshotImageFormat.Png); } }
public void ExtractAllFlagsInTheWorld() { var indexPage = new IndexPage(_driver); var countryPage = new CountryPage(_driver); indexPage.NavigateTo("http://flagpedia.net/index"); var countryNames = indexPage.GetNames(); //List<string> listOfNames = new List<string>(); --> po lesen variant bez 2ri foreach samo s 1 foreach, i NOV URL za vsqka dyrjava foreach (var element in countryNames) { //listOfNames.Add(element.Text); string url = "http://flagpedia.net/" + element.ToLower(); countryPage.NavigateTo(url); ((IJavaScriptExecutor)_driver).ExecuteScript("window.scrollTo(0, document.body.scrollHeight - 150)"); Thread.Sleep(2000); var screenshot = ((ITakesScreenshot)_driver).GetScreenshot(); screenshot.SaveAsFile(Path.GetFullPath(@"../../../Screenshots/") + BuildName(countryPage) + ".png", ScreenshotImageFormat.Png); } }