TestingDocs.com
    Software Testing website
    • Automation
      • Selenium
      • JBehave Framework
    • Tutorials
      • MySQL Tutorials
      • Testlink
      • Maven
      • Git
    • IDEs
      • IntelliJ IDEA
      • Eclipse
    • Flowcharts
      • Flowgorithm
      • Raptor
    • About

    Selenium

    Working with Slider Example

    Overview

    In this tutorial, we will see how to interact with Slider Example using Selenium. We can interact with Slider using Actions class. Actions class can help us to move this kind of sliders in Webdriver tests. We can instantiate the Action class as shown below:

    Actions action = new Actions(driver);

    We can simulate the slide action in many ways.In the below code I have used dragAndDrop operation. Also, we can slide either by number of pixels or percentage of slider bar length. Furthermore, we will perform the slide operation on the JQuery website which has a demo slider on it : https://jqueryui.com/slider

    I have identified the slider using Firefox developer tools as shown below:

     

    Slider Example

     

    Slider Example

    public class SliderDemo { 
     WebDriver driver ;
     
    @BeforeClass
     public void startBrowser() {
     driver = new FirefoxDriver();
     driver.manage().window().maximize();
    }
    
    @Test
    public void doSlideTest()
    {
     driver.get("https://jqueryui.com/slider/"); 
     driver.manage().window().maximize(); 
     driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 
     
     driver.switchTo().frame(driver.findElement(By.className("demo-frame")));
     WebElement slider = driver.findElement(By.xpath("//*[@id='slider']/span")); 
     Actions actions = new Actions(driver); 
     actions.moveToElement(slider).dragAndDropBy(slider, 150, 0).build().perform(); 
     System.out.println("Slide Action performed.");
     
     } 
    
    @AfterClass
    public void closeBrowser() {
    if(driver != null)
    {
     driver.quit();
     }
    }
    }

     

    In conclusion, many modern web applications are using sliders allowing users to modify the values of the web entities on the web pages. Sliders are common web elements on websites. Also, there are perfect for providing the users customization in many scenarios .For example , like mortgage loan calculator and slider for selecting term etc.

    —

    Selenium Tutorials on this website:

    https://www.testingdocs.com/selenium-webdriver-tutorial/

    Official Website:

    https://www.selenium.dev/

    Related Posts

    Windows 10 Settings

    Selenium /

    Add Microsoft Webdriver on Windows OS

    Download Selenium Components

    Selenium /

    Getting Started with Selenium Webdriver

    LambdaTest Testing Cloud SaaS Platform

    Selenium /

    LambdaTest – Testing Cloud SaaS Platform

    Selenium /

    Selenium 3.0 and Mozilla GeckoDriver

    SauceLabs Website

    Selenium /

    Run an Example Test on SauceLabs

    ‹ Scroll Webpage using JavaScript› Custom Firefox Profile for Selenium Webdriver

    Recent Posts

    • ChatGPT Plans Free and PlusChatGPT Subscription Plans
    • Stellar Converter for Database ToolStellar Converter for Database
    • Stellar MySQL Log AnalyzerStellar Log Analyzer for MySQL
    • Stellar Repair for MySQLStellar Repair for MySQL
    • ChatGPT IntroductionChatGPT Capabilities
    • How to secure your SQL Database: Tips and Tricks
    • ChatGPT4 Conversational AI FeaturesChatGPT4 Conversational AI Features
    • Trends in Software EngineeringShaping the Future of Development: Exploring Key Trends in Software Engineering
    • Java PerformanceImproving Java Performance with Multithreading
    • QDrant Vector DatabaseOpen-source Vector Databases
    • Difference between PHP and JavaScript?
    • Bing AI Browser Web ContentBing Conversation Styles
    • ChatGPT PreviewChatGPT Introduction
    • Open Source AI Frameworks TensorFlowOpen Source AI Frameworks
    • Artificial Intelligence Tools

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com