diff --git a/src/test/java/org/dvsa/testing/framework/pageObjects/BasePage.java b/src/test/java/org/dvsa/testing/framework/pageObjects/BasePage.java index fad229e35..64493f6d5 100644 --- a/src/test/java/org/dvsa/testing/framework/pageObjects/BasePage.java +++ b/src/test/java/org/dvsa/testing/framework/pageObjects/BasePage.java @@ -674,9 +674,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) { diff --git a/src/test/java/org/dvsa/testing/framework/stepdefs/vol/EBSRUpload.java b/src/test/java/org/dvsa/testing/framework/stepdefs/vol/EBSRUpload.java index cfb062731..e08538ff7 100644 --- a/src/test/java/org/dvsa/testing/framework/stepdefs/vol/EBSRUpload.java +++ b/src/test/java/org/dvsa/testing/framework/stepdefs/vol/EBSRUpload.java @@ -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) {