Skip to content

Commit

Permalink
Add chrome to the list of browsers with "force_scroll"
Browse files Browse the repository at this point in the history
  • Loading branch information
ikerreyes committed Jan 11, 2022
1 parent b5f5b1b commit 56ae6d9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/widgetastic/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,10 @@ def move_to_element(self, locator: LocatorAlias, *args, **kwargs) -> WebElement:
return el

# FF60+ doesn't raise MoveTargetOutOfBoundsException. it just silently does nothing
if self.browser_type == "firefox" and self.browser_version >= 60 and force_scroll:
if (
(self.browser_type == "firefox" and self.browser_version >= 60)
or self.browser_type == "chrome"
) and force_scroll:
self.execute_script("arguments[0].scrollIntoView({block: 'center'});", el)

move_to = ActionChains(self.selenium).move_to_element(el)
Expand Down

0 comments on commit 56ae6d9

Please sign in to comment.