public void SeleniumPageSourceFileIsCreated() { WebDriver.Navigate().GoToUrl(TestSiteUrl); WebDriver.Wait().ForPageLoad(); string pageSourcePath = SeleniumUtilities.SavePageSource(WebDriver, TestObject, "TempTestDirectory", "SeleniumPSFile"); Assert.IsTrue(File.Exists(pageSourcePath), "Failed to find Page Source"); File.Delete(pageSourcePath); }
public void SavedPageSourceTestObjectAssociation() { WebDriver.Navigate().GoToUrl(TestSiteUrl); WebDriver.Wait().ForPageLoad(); string pageSourcePath = SeleniumUtilities.SavePageSource(WebDriver, TestObject, "TempTestDirectory", "TestObjAssocTest"); Assert.IsTrue(TestObject.ContainsAssociatedFile(pageSourcePath), "The saved page source wasn't added to the associated files"); File.Delete(pageSourcePath); }
public void SeleniumPageSourceFileIsCreatedDeprecated() { WebDriver.Navigate().GoToUrl(TestSiteUrl); WebDriver.Wait().ForPageLoad(); #pragma warning disable CS0618 // Type or member is obsolete string pageSourcePath = SeleniumUtilities.SavePageSource(WebDriver, "TempTestDirectory", "OldSeleniumPSFile"); #pragma warning restore CS0618 // Type or member is obsolete Assert.IsTrue(File.Exists(pageSourcePath), "Failed to find Page Source"); File.Delete(pageSourcePath); }
public void SavePageSourceThrownException() { FileLogger tempLogger = new FileLogger { FilePath = "<>\0" // illegal file path }; TestObject.Log = tempLogger; WebDriver.Navigate().GoToUrl(TestSiteUrl); WebDriver.Wait().ForPageLoad(); bool successfullySaved = SeleniumUtilities.SavePageSource(WebDriver, TestObject); Assert.IsFalse(successfullySaved); }
public void SavePageSourceThrownExceptionDeprecated() { FileLogger tempLogger = new FileLogger { FilePath = "<>" // illegal file path }; WebDriver.Navigate().GoToUrl(TestSiteUrl); WebDriver.Wait().ForPageLoad(); #pragma warning disable CS0618 // Type or member is obsolete bool successfullySaved = SeleniumUtilities.SavePageSource(WebDriver, tempLogger); #pragma warning restore CS0618 // Type or member is obsolete Assert.IsFalse(successfullySaved); }
public void SeleniumPageSourceWithConsoleLogger() { WebDriver.Navigate().GoToUrl(TestSiteUrl); WebDriver.Wait().ForPageLoad(); // Create a console logger and calculate the file location ConsoleLogger consoleLogger = new ConsoleLogger(); string expectedPath = Path.Combine(LoggingConfig.GetLogDirectory(), "PageSourceConsole.txt"); TestObject.Log = consoleLogger; // Take a screenshot SeleniumUtilities.SavePageSource(this.WebDriver, this.TestObject, "Console"); // Make sure we got the screenshot and than cleanup Assert.IsTrue(File.Exists(expectedPath), "Fail to find screenshot"); File.Delete(expectedPath); }
public void SeleniumPageSourceWithConsoleLoggerDeprecated() { WebDriver.Navigate().GoToUrl(TestSiteUrl); WebDriver.Wait().ForPageLoad(); // Create a console logger and calculate the file location ConsoleLogger consoleLogger = new ConsoleLogger(); string expectedPath = Path.Combine(LoggingConfig.GetLogDirectory(), "PageSourceOldConsole.txt"); // Take a screenshot #pragma warning disable CS0618 // Type or member is obsolete SeleniumUtilities.SavePageSource(this.WebDriver, consoleLogger, "OldConsole"); #pragma warning restore CS0618 // Type or member is obsolete // Make sure we got the screenshot and than cleanup Assert.IsTrue(File.Exists(expectedPath), "Fail to find screenshot"); File.Delete(expectedPath); }