Playwright
  • Introduction
    • Playwright With TS
  • Automation the right things with Playwright
  • Setup
    • Setting Up Your Environment
    • Typescript fundamental
    • Setup Playwright TS Project in VS code
    • Record and Playback with Code Generation using VS Code Playwright Extension
    • Record and Playback using Playwright Codegen with Inspector
  • Playwright config file
  • Implement Test Cases
    • Open Browser
    • Fake Geolocation
    • Form Authentication
    • Checkboxes
    • Dropdown
    • Hyperlink
    • Web Table
    • Drag Drop
    • Frame
    • Horizontal Slide
    • Context Click - Right Click
  • Hover
  • Take Screenshot
  • Automatic screenshots on failure:
  • Page Object Model
    • Understanding the Page Object Model pattern
  • Implementing POM with Login Page
  • Combine POM with Playwright Fixture
  • API Testing
    • API Docs
  • GET
  • API POST
  • PUT
  • DELETE
  • CI/CD And Reporting
    • Setup Allure Report
    • Run in Github Actions
  • Playwright & AI
    • Debug & Generate Playwright Tests with AI
Powered by GitBook
On this page
  1. Implement Test Cases

Horizontal Slide

import {test, expect} from '@playwright/test';

test('change range slider value', async ({ page }) => {
    // Go to the horizontal slider page
    await page.goto('https://the-internet.herokuapp.com/horizontal_slider');
    
    // Get the initial value of the slider
    const slider = page.locator('.sliderContainer input');
    
    var sliderValue = Number(await page.locator('#range').innerText());
    const range = 3.5 // set a value between 0-5 , intervals of 0.5 only
    while (sliderValue < range) {   
        await slider.press('ArrowRight');
        sliderValue = Number(await page.locator('#range').innerText());
    }
    expect(sliderValue).toBe(range);
})
PreviousFrameNextContext Click - Right Click

Last updated 15 days ago