Selenium scrollIntoView() for Internet Explorer

114 views
Skip to first unread message

Shifali Gupta

unread,
Oct 22, 2018, 6:29:46 AM10/22/18
to Selenium Users
I want to use selenium scrollIntoView() method for Internet Explorer but this

((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", _webElement_ );

is not working.

And, I have researched on google which says maybe we have to use jquery plugin. I don't know what to do. Please tell me a way to execute scrollIntoView() in IE11 without any plugin.

Thiago Salgado

unread,
Oct 22, 2018, 9:54:12 PM10/22/18
to seleniu...@googlegroups.com
use some function that go to element after it render, like:

from selenium.webdriver.common.action_chains import ActionChains

element = driver.find_element_by_id("id")

actions = ActionChains(driver)
actions.move_to_element(element).perform()

or 

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



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/bb14b393-c509-4b5a-ac2e-4242f95c427a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

arun sharma

unread,
Oct 23, 2018, 11:02:57 AM10/23/18
to Selenium Users

Internet Explorer 11 has a bug in scrollIntoView(), which causes the whole page to move horizontally in some cases:

There are various workarounds, like using jQuery, but this can be a problem when running Selenium tests, something like this:

WebElement element = driver.findElement(By.id("my-id"));
Actions actions = new Actions(driver);
actions.moveToElement(element);
actions.click();
Selenium's in-built handling of moveToElement is to use scrollIntoView().What can be done instead, is to polyfill/fix the scrollIntoView() function itself, so that Selenium can use it.
Learn advanced Selenium and Manual Testing Training in Navalur .

NagaRaju

unread,
Oct 23, 2018, 11:15:47 AM10/23/18
to seleniu...@googlegroups.com
Hi Arun,

How to polyfill/ fix scrollView() function?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

Thiago Salgado

unread,
Oct 23, 2018, 1:13:17 PM10/23/18
to seleniu...@googlegroups.com
I just think is best use another web browser... IE is so old and many pages does not support IE anymore


Reply all
Reply to author
Forward
0 new messages