I have a simple function that takes screenshots while running Xunit test. The test is straight forward.
ITakesScreenshot screenshotHandler = PropertiesCollection.driver as ITakesScreenshot;
Screenshot screenshot = screenshotHandler.GetScreenshot();
screenshot.SaveAsFile(@"C:\Users\Slim\Screenshots\" + filename + ".png", ImageFormat.Png);
And it works, but we are using VSTS and when somebody else is using the test, it breaks since the path is no longer valid. C:\Users\Slim\Screenshots\
It is possible to change the path of the code to the path where you have the files locally but that is not good practice of course :)
I have tried to use AppDomain.CurrentDomain.BaseDirectory but with no luck.
ITakesScreenshot screenshotHandler = PropertiesCollection.driver as ITakesScreenshot;
Screenshot screenshot = screenshotHandler.GetScreenshot();
screenshot.SaveAsFile(AppDomain.CurrentDomain.BaseDirectory + //Screenshots//" + filename + ".png", ImageFormat.Png);
Any good advice's?