Emulating mouse wheel scrolling and pressing keys in Selenium webdriver + node.js

  • A specific test on a site page requires page scrolling.

    Is it possible to emulate mouse wheel scrolling?
    And is it possible to emulate keystrokes? For example "Page Down"

    I use the standard library for node.js selenium-webdriver

  • Junior Test Automation

    Have you tried using the following?

    element = driver.findElement(By.linkText(text));
    driver.executeScript("arguments[0].scrollIntoView()", element);

  • Selenium doesn't have such built-in capabilities. You need to understand that Selenium itself is a kind of wrapper over the JS + Browser API. Any scrolling and pageDown methods are not available from under the box. And you will need to implement them yourself. For this reason, frameworks appear on top of Selenium like EPAM JDI, Selenid, etc.

Suggested Topics