Skip to content

Commit c6ab2a3

Browse files
committed
Add overloaded shootElement for dynamically finding elements to avoid StaleElementReference
1 parent 1a09053 commit c6ab2a3

File tree

1 file changed

+1
-2
lines changed
  • src/main/java/com/assertthat/selenium_shutterbug/utils/web

1 file changed

+1
-2
lines changed

src/main/java/com/assertthat/selenium_shutterbug/utils/web/Browser.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,8 +839,7 @@ public void scrollToElement(WebElement element) {
839839
}
840840

841841
public void scrollToElement(By by) {
842-
driver.findElement(by);
843-
executeJsScript(SCROLL_INTO_VIEW_JS, by);
842+
executeJsScript(SCROLL_INTO_VIEW_JS, driver.findElement(by));
844843
}
845844

846845
public void scrollToElementVerticalCentered(WebElement element) {

0 commit comments

Comments
 (0)