The blog gives you idea of testing and automation testing example of selenium webdriver,SQl and Jmeter, you see the basic example of selenium web driver and get idea how to do automation testing,

Mover Slider From one position to other

I have a web application which have a slider, when I click or drag pointer on slider then below displayed data should changed. user can move slider to specific point eg: 2, 6, 8 and 10 Days.
I can drap slider at 2 days then data of 2 day displayed in below table.

I write code for that slider, it is very simple and under stable. you can choose "postionOfSlider" value should be any.


public static void dragdrop(){
     int postionOfSlider=10;
        WebElement slider = driver.findElement(By.id("dragdrop"));  // Position of element
        int width=slider.getSize().getWidth();   // Width of Slider or element
        Actions move = new Actions(driver);
        move.moveToElement(slider, ((width*postionOfSlider)/100), 0).click();
         // move to a specific point on the dragpoint
       move.build().perform();
       System.out.println("Slider moved");

      }

we can also used for-loop to drag slider or move slider from one point to another point on the webpage with the help of above code.

No comments

Post a Comment

Powered by Blogger.