Hi,
As many users, I have sometimes been struggling with the Scroll Element Into View keyword, and finally set something like this to be able to reach element even when there’s no other element or a footer for example:
@keyword("Scroll Element With Offset")
def scroll_element_with_offset(self, locator, Xoffset=0, Yoffset=0):
try:
element = self.driver.find_element(locator)
origin = ScrollOrigin.from_element(element)
ActionChains(self.driver).scroll_from_origin(origin, Xoffset, Yoffset).perform()
except (
ElementClickInterceptedException,
StaleElementReferenceException,
) as e:
raise Exception(
f"Failed to find element {locator} for scrolling"
) from e
So I was wondering if this could be an add to the library, or even better an improvement of the current keyword (with default value as above to avoid new keyword).
However I’m unsure about the limitations, or reasons/implementation choices on the current keyword?
For example use other scroll methods from Selenium driver.
If somebody has hints
Thanks!
Charlie