com.applitools.eyes.MoveToRegionVisibilityStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eyes-selenium-java-jersey1x-sf2_48_2 Show documentation
Show all versions of eyes-selenium-java-jersey1x-sf2_48_2 Show documentation
Applitools Eyes SDK for Selenium Java WebDriver
The newest version!
package com.applitools.eyes;
/**
* An implementation of {@link RegionVisibilityStrategy}, which tries to move
* to the region.
*/
class MoveToRegionVisibilityStrategy implements RegionVisibilityStrategy {
private final Logger logger;
private PositionMemento originalPosition;
public MoveToRegionVisibilityStrategy(Logger logger) {
this.logger = logger;
}
public void moveToRegion(PositionProvider positionProvider,
Location location) {
logger.verbose("Getting current position state..");
originalPosition = positionProvider.getState();
logger.verbose("Done! Setting position..");
positionProvider.setPosition(location);
logger.verbose("Done!");
}
public void returnToOriginalPosition(PositionProvider positionProvider) {
logger.verbose("Returning to original position...");
positionProvider.restoreState(originalPosition);
logger.verbose("Done!");
}
}