Several sites do possess slider components as if you can easily see in certain journey sites like listed below. this second can be done utilizing mouse event and idea could be greatly like the aged post on mouse occasion. I’ll have a test exemplory instance of working signal using phony information inside-so you are able to move your enter and find out this operating. Listed here is comprehensive clarification: you have to maintain several issues in your mind:
- Slider club size might or might not differ centered on visitor dimension.
- You might need to slip possibly by quantity of pixels or proportion of slider bar duration.
I’ll consider really universal exemplory instance of http://jqueryui.comORslider/ to describe most actions. Initial cause to pick this instance is the fact that how big slider club is modifying centered on visitor dimension and next its readily available for everybody T. Within the signal beneath, I’ll initial attempt to obtain the dimension of club in the present visitor dimension wherever I do want to execute slider motion after which centered on req I’ll transfer the slider. Be sure you don’t alter the visitor dimension between studying the slider bar dimension and performing slipping motion.
1.Open url via selenium code.
2.Switch to the container frame to reach the slider and slider bar web element.
3.Select the bar and get the width.
4.Now we need to move slide to 50% (231px) or 100px. We can write small java/.net program to calculate desired percentage in pix using the width of the bar as 463 in my case. But I will move only 40pixels.
5.Get web element for the slider on bar.
6.Now we want move the slider in right side horizontally means towards Y axis. To perform movement action we will use action class and use mouse event. To move horizontally we need to move in Y direction of screen so we can use MoveByOffset
i.e. X axis: 0 & Y axis: 40px. So first create action, Click and hold the slider, move to some pix as follows.
For more information on Selenium Tutorials around the web: