Search code examples
c#seleniumscreenshotapplitools

Can not take a full page screenshot in Applitools C#


I'm trying to take a full screen screenshot of my page by using this code:

public void OpenEyesForVisualTesting(string testName) {
 this.seleniumDriver.Driver = this.eyes.Open(this.seleniumDriver.Driver, "Zinc", testName);

}

public void CheckScreenForVisualTesting() {
 this.eyes.Check("Zinc", Applitools.Selenium.Target.Window().Fully());
}

public void CloseEyes() {
 this.eyes.close();
}

but instead I just get a half a page of the screenshot, I tried to contact Applitools but they just told me to replace eyes.checkwindow() to eyes.Check("tag", Target.Window().Fully()); which still didn't work.

If anyone can help me that would be great.


Solution

  • I work for Applitools and sorry for your troubles. Maybe you did not see our replies or they went to your spam folder. You need to set ForceFullPageScreenshot = true and StitchMode = StitchModes.CSS in order to capture a full page screenshot.

    The below code example is everything you'd need to do in order to capture a full page image. Also, please make sure your .Net Eyes.Sdk version is >= 2.6.0 and Eyes.Selenium >= 2.5.0.

    If you have any further questions or still encountering issues with this please feel free to email me directly. Thanks.

    var eyes = new Eyes();
    eyes.ApiKey = "your-api-key";
    eyes.ForceFullPageScreenshot = true;
    eyes.StitchMode = StitchModes.CSS;
    
    eyes.Open(driver, "Zinc", testName, new Size(800, 600)); //last parameter is your viewport size IF testing on a browser. Do not set if testing on a mobile devices.
    eyes.CheckWindow("Zinc");
    //or new Fluet API method
    eyes.Check("Zinc", Applitools.Selenium.Target.Window().Fully();
    eyes.Close();