Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scroll_element_into_view workaround for Firefox "MoveTargetOutOfBoundsException" error #1816

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/SeleniumLibrary/keywords/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.remote.webelement import WebElement

from selenium.common.exceptions import MoveTargetOutOfBoundsException
from SeleniumLibrary.base import LibraryComponent, keyword
from SeleniumLibrary.errors import ElementNotFound
from SeleniumLibrary.utils.types import type_converter
Expand Down Expand Up @@ -747,7 +747,11 @@ def scroll_element_into_view(self, locator: Union[WebElement, str]):
element = self.find_element(locator)
# _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater.
element = _unwrap_eventfiring_element(element)
ActionChains(self.driver).move_to_element(element).perform()
try:
ActionChains(self.driver).move_to_element(element).perform()
except MoveTargetOutOfBoundsException as e:
self.debug(f"Move to element with error: {e}.")
self.driver.execute_script("arguments[0].scrollIntoView(true);", element)

@keyword
def drag_and_drop(
Expand Down