public static void SetUp() { driver = CustomDriver.GetChromeDriver(); home = new SpygataukuotaHomePage(driver); search = new SpygataukuotaSearchResultPage(driver); product = new SpygataukuotaProductPage(driver); shipp = new SpygataukuotaShippingSelection(driver); form = new SpygataukuotaBuyingForm(driver); fbHome = new FacebookSpygataukuotaHome(driver); contacts = new SpygataukuotaContacts(driver); google = new GoogleMapsPage(driver); recovery = new SpygataukuotaPasswordRecovery(driver); }
public void OpenGoogleMapLinksAndTakeAndSaveScreenshots() { HomePage homePage = new HomePage(_driver); SearchPage searchPage = new SearchPage(_driver); AdvancedSearchPage advancedSearchPage = new AdvancedSearchPage(_driver); SearchResultsPage searchResultsPage = new SearchResultsPage(_driver); ResultDetailsPage resultDetailsPage = new ResultDetailsPage(_driver); homePage.clickSearchButton(); searchPage.clickConsentButton(); searchPage.clickAdvancedSearchButton(); Assert.IsTrue(advancedSearchPage.isAdvancedSearchHeadingDisplayed()); advancedSearchPage.searchForTown("Ale"); Debug.WriteLine(_driver.Title); Assert.AreEqual <string>("Free Zip Code Finder and Lookup", _driver.Title); string[] urls = searchResultsPage.getResultsUrls(); for (int i = 0; i < 10; i++) { _driver.Navigate().GoToUrl(urls[i]); string city = resultDetailsPage.getCity(); string state = resultDetailsPage.getState(); string zipCode = resultDetailsPage.getZipCode(); string longitude = resultDetailsPage.getLongitude(); string latitude = resultDetailsPage.getLatitude(); googleMapsUrls[i] = $"https://www.google.com/maps/place/{latitude}+{longitude}"; Debug.WriteLine($"City: {city}, State: {state}, Zip Code: {zipCode}, Longitude: {longitude}, Latitude: {latitude}, Google Maps URL: {googleMapsUrls[i]}"); _driver.Navigate().GoToUrl(googleMapsUrls[i]); GoogleMapsPage googleMapsPage = new GoogleMapsPage(_driver); if (i == 0) { googleMapsPage.waitToLoadAndClickAccept(); } string filename = $"{city}-{state}-{zipCode}.{ScreenshotImageFormat.Png}"; string fullPath = Path.Combine(Path.GetTempPath(), filename); Debug.WriteLine(fullPath); TakeFullScreenshot(_driver, fullPath); Assert.IsTrue(File.Exists(fullPath), "The screenshot map file was not found."); } }
public void TakeScreenshotsByCityCoordinates() { FirefoxProfile profile = new FirefoxProfile(); profile.AddExtension(this.adBlockPath); this.driver = new FirefoxDriver(profile); //ChromeOptions options = new ChromeOptions(); //options.AddExtension(this.adBlockChromePath); //this.driver = new ChromeDriver(this.chromeDriverPath, options); this.driver.Manage().Window.Maximize(); this.driver.Url = this.baseUrl; this.driver.Url = this.cityListUrl; CityListPage cityListPage = new CityListPage(); this.WaitForElement(cityListPage.ResultsTableLocator); IWebElement[] links = this.driver.FindElements(cityListPage.ResultsTableLocator).ToArray(); List <string> linkUrls = new List <string>(); for (int i = 0; i < 10; i++) { linkUrls.Add(links[i].GetAttribute("href")); } CityInfoPage cityInfoPage = new CityInfoPage(); GoogleMapsPage googleMapsPage = new GoogleMapsPage(); foreach (var linkUrl in linkUrls) { this.driver.Url = linkUrl; this.WaitForElement(cityInfoPage.CityTableLocator); CityInfo info = cityInfoPage.GetCityInfo(this.driver); this.driver.Url = info.GoogleMapsLink; this.WaitForElement(googleMapsPage.StreetViewControl); this.TakeScreenshot(this.screenshotsPath + info.ToString() + ".jpg"); } this.driver.Dispose(); }
public void ConfirmGoogleMapsPage() { Thread.Sleep(3000); WindowHelper.SwitchToNewWindow(webDriver); GoogleMapsPage contactUsPage = new GoogleMapsPage(webDriver); }