All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.applitools.eyes.selenium.positioning.RegionPositionCompensationFactory Maven / Gradle / Ivy

There is a newer version: 3.36
Show newest version
package com.applitools.eyes.selenium.positioning;

import com.applitools.eyes.BrowserNames;
import com.applitools.eyes.Logger;
import com.applitools.eyes.UserAgent;
import com.applitools.eyes.selenium.Eyes;

public class RegionPositionCompensationFactory {

    public static RegionPositionCompensation getRegionPositionCompensation(UserAgent userAgent, Eyes eyes, Logger logger) {
        if (userAgent.getBrowser().equals(BrowserNames.Firefox)) {
            try {
                if (Integer.parseInt(userAgent.getBrowserMajorVersion()) >= 48) {
                    return new FirefoxRegionPositionCompensation(eyes, logger);
                }
            } catch (NumberFormatException e) {
                return new NullRegionPositionCompensation();
            }
        } else if (userAgent.getBrowser().equals(BrowserNames.Safari)) {
            return new SafariRegionPositionCompensation();
            //regionInScreenshot = regionInScreenshot.offset(0, (int) Math.ceil(pixelRatio));
        }

        return new NullRegionPositionCompensation();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy