Wrong WebElement visibility/position reported after JS invoked scroll

15 views
Skip to first unread message

Danail Kozhuharov

unread,
May 25, 2015, 11:26:08 PM5/25/15
to seleniu...@googlegroups.com
CONTEXT:
* I am using JS calls to augment WebDriver's functionality.
* I'm using a JS call to modify these attributes: "scrollLeft" and "scrollTop" and to cause scrolling of a container element

OBSERVATION:
* I noticed that after the JS call, all following calls to functions: "WebElement.isDisplayed()" and "WebElement.getLocation()" return non-updated values.

QUESTION:
* Does anyone has an idea how I can force/nudge/hint the WebDriver to update its internal WebElement cache after the JS call ?

NOTE-1: The WebElement instances are "fresh" retrieved only after the JS call that invokes scrolling.
NOTE-2: For various reasons I can't rely on WebDriver's native auto-scrolling

Thanks !

Mercious

unread,
May 26, 2015, 11:56:43 AM5/26/15
to seleniu...@googlegroups.com
Does simply re-locating the WebElement not work??
yourJSScroll(someElement);
someElement = yourDriver.findElement(By.id("someElement"));
someElement.whatever();

Reply all
Reply to author
Forward
0 new messages