Selenium WebDriver 4

Scroll an element into view

Medium70 pts~25 min
  • Scrolling
  • Viewport
Practice app · Profile Settings

A settings page for clicking, typing, reading text/attributes/CSS and element state.

Test URL
/lab/selenium-scroll-an-element-into-view

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Bring an element far below the fold into the viewport and verify it.

Your task

  1. 1Open TEST_URL.
  2. 2Locate #scroll-target.
  3. 3Scroll it into view with the Actions API (scrollToElement) or JavaScript scrollIntoView().
  4. 4Assert it is displayed and reads “You scrolled here”.

Acceptance criteria

  • The element is scrolled into view
  • #scroll-target reads “You scrolled here”
  • At least 2 assertions pass

Selenium WebDriver 4 · Selenium · Interactions