Skip to content

Commit

Permalink
Merge pull request #1041 from dvsa/features/scrollToBottom
Browse files Browse the repository at this point in the history
feat: add scroll to bottom on ebsr
  • Loading branch information
sr4850 authored Jan 10, 2025
2 parents 1cab522 + 4594321 commit da45c2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -671,9 +671,12 @@ public static String getSelectedTextFromDropDown(@NotNull String selector, @NotN
return option.getFirstSelectedOption().getText();
}

public static void scrollToBottom() {
JavascriptExecutor js = (JavascriptExecutor) getDriver();
js.executeScript("window.scrollTo(0, document.body.scrollHeight)");
public void scrollToBottom() {
WebElement footer = getDriver().findElement(By.tagName("govuk-footer"));
int deltaY = footer.getRect().y;
new Actions(getDriver())
.scrollByAmount(0, deltaY)
.perform();
}

public boolean pageContains(String text) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public void documentsAreGenerated() throws IllegalBrowserException, IOException

} while ((long) findElements("//*[@class='field file-upload']", SelectorType.XPATH).size() < 2 && System.currentTimeMillis() < kickOutTime);
try {
scrollToBottom();
assertTrue(findElements("//*[@class='field file-upload']", SelectorType.XPATH).stream().anyMatch(
webElement -> webElement.getText().contains("Route Track Map PDF (Auto Scale)")));
} catch (Exception e) {
Expand Down

0 comments on commit da45c2d

Please sign in to comment.