Endtest

Endtest

›Web Tests

Web Tests

  • How to create Web Tests
  • Finding elements in Web Applications
  • How to execute Web Tests
  • Assertions for Web Tests
  • IF Statements for Web Tests
  • Web Applications with restricted access
  • How to test in iframes
  • How to test in multiple tabs
  • How to test File Uploads
  • How to test File Downloads
  • How to test Emails
  • How to test PDF files
  • How to test Chrome Extensions
  • Dealing with reCAPTCHA
  • Dealing with Dynamic Locators
  • Dealing with Canvas Elements
  • Performing a Drag and Drop
  • Execute JavaScript
  • Testing WebRTC Applications
  • How to scroll in Web Tests
  • How to test Checkboxes
  • How to test Dropdowns
  • Dealing with Sessions
  • Web Crawler
  • Export Web Tests
  • Migrating from Selenium

Mobile Tests

  • How to create Mobile Tests
  • Finding elements in Mobile Applications
  • How to execute Mobile Tests
  • Assertions for Mobile Tests
  • IF Statements for Mobile Tests
  • How to scroll in Mobile Tests
  • Performing Complex Gestures

Advanced

  • Variables
  • Waits
  • Endtest API
  • Scheduler
  • Drive
  • Adding Collaborators
  • Computer Vision
  • Importing Test Cases
  • Using Loops
  • Data-driven Testing
  • Send API Requests
  • Read SMS
  • Execute SQL queries
  • Self-Healing Tests
  • Email Notifications
  • Slack Notifications
  • PagerDuty Notifications
  • Webhook Notifications
  • Automatic Backup
  • Advanced Settings
  • Multiple environments
  • How to stop a test
  • Utilities
  • Utilities API
  • Team
  • On-Premises

Integrations

  • Atlassian Jira
  • Slack
  • PagerDuty
  • Microsoft Teams
  • Mattermost
  • Jenkins
  • GitHub
  • Azure DevOps
  • GitLab
  • TeamCity
  • CircleCI
  • TravisCI
  • Bitbucket
  • Heroku
  • Bamboo Server
  • Test Case Management
  • SSO
  • BrowserStack
  • Sauce Labs

How to scroll in Web Tests

Introduction

You might encounter scenarios where you need to perform a scroll.

There are 2 types of scrolls that we'll cover in this chapter:

1. Scroll the entire window.

2. Scroll inside an element.

By default, the Endtest Chrome Extension will not record scroll events.

You can change this by enabling the Record Scroll Events option.

endtest recorder scroll

With that option enabled, scroll events for the entire window will be recorded.

It will not record scroll events inside elements.

1. Scroll the entire window.

In order to scroll the entire window, you can use the Scroll action.

That action allows you to provide a scroll distance in pixels or a destination.

endtest recorder scroll

You can also scroll the entire window by using an Execute JavaScript step:

window.scrollTo(0, 500);

The first parameter is the destination to scroll to, along the x-axis (horizontal), in pixels.

And the second parameter is the destination to scroll to, along the y-axis (vertical), in pixels.

The Scroll action works only for scenarios where the entire browser window needs to be scrolled. This applies when the scrollbar spans the full height of the screen and is located on the right side of the window.

If you need to scroll within a specific element (e.g., a div with its own scrollbar), the Scroll action will not work for such situations.

2. Scroll inside an element.

The only way to scroll inside an element is by using an Execute JavaScript step:

document.querySelector("css-selector-of-element").scrollTop = 500;

You will need to get the CSS Selector for your element and add in the JavaScript code.

And you will also specify the number of pixels the element's content is scrolled vertically.

If the number is a negative value, the number is set to "0".

If the element cannot be scrolled, the number is set to "0".

If the number is greater than the maximum allowed scroll amount, the number is set to the maximum number.

You can also use scrollLeft if you want to scroll horizontally inside an element.

← Testing WebRTC ApplicationsHow to test Checkboxes →
  • Introduction
  • 1. Scroll the entire window.
  • 2. Scroll inside an element.
© Endtest Inc.