Skip to content

Commit

Permalink
fix lint, simplify method usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Logan Graham committed May 31, 2024
1 parent 7008343 commit 3a27269
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions visual-java/src/main/java/com/saucelabs/visual/VisualApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ private List<ElementIn> extractIgnoreElements(CheckOptions options) {
List<ElementIn> result = new ArrayList<>();
for (int i = 0; i < ignoredElements.size(); i++) {
WebElement element = ignoredElements.get(i);
if (validateRemoteElement(element) == null) {
if (validate(element) == null) {
throw new VisualApiException("options.ignoreElement[" + i + "] does not exist (yet)");
}
result.add(VisualRegion.ignoreChangesFor(element).toElementIn());
Expand All @@ -530,14 +530,7 @@ private List<ElementIn> extractIgnoreElements(CheckOptions options) {
}

private WebElement validate(WebElement element) {
if (element == null || !element.isDisplayed() || element.getRect() == null) {
return null;
}
return element;
}

private WebElement validateRemoteElement(WebElement element) {
if (element != null && element instanceof RemoteWebElement && element.isDisplayed()) {
if (element instanceof RemoteWebElement && element.isDisplayed()) {
return element;
}
return null;
Expand Down

0 comments on commit 3a27269

Please sign in to comment.