scrollIntoView() is scrolling to much down scrollIntoView() is scrolling to much down selenium selenium

scrollIntoView() is scrolling to much down


Solution 1

If you only need to click the element you just can do:

driver.find_element_by_xpath("//table[@id='idMainGriddata_columns']/tbody/tr/td[contains(text(), '" + column + "')]").click()

And if you have Js implemented for that it should scroll into it.

Solution 2 (dirty way)

If your column variable is integer:

column += 2

Solution 3

Add alignToTop to your scrollIntoView:

self.driver.execute_script("return arguments[0].scrollIntoView(true);", element)