Skip to main content
This test types a URL into Chrome’s address bar, scrolls down, and asserts that the heading is out of view.

Watch it run

The test

navigate-and-scroll.test.mjs

How it works

  • find() with zoom: true locates the element in two passes for extra precision. This helps with small targets like the address bar.
  • pressKeys(['ctrl', 'a']) selects the current URL so type() replaces it.
  • The test clicks the page before scrolling so the page, not the address bar, gets the scroll.
  • scroll('down', { amount: 1000 }) scrolls down with the mouse wheel.

Run it

The test is in the TestDriver SDK repository. Clone it, install dependencies, and run the file:
The test reads your API key from TD_API_KEY. Create a key at console.testdriver.ai/team/api-keys. Then set it in your environment or a .env file.