1

I can't imaging how to handle below type of slider option using selenium with java. There is no different xpaths for dropping locations. There should be different xpaths to use below option

Actions.dragAndDrop(Sourcelocator, Destinationlocator)

So how to handle this kind of one?enter image description here

DOM: enter image description here

[2]: https://i.stack.imgur.com/qX1NO.png

2
  • 1
    For us to provide any answer, can you add the DOM of this slider to your question? Without knowing how the HTML is setup, we can't provide answers.
    – Lee Jensen
    May 27 at 17:23
  • Hey @LeeJensen.. added ss above
    – Rush910
    May 27 at 17:37
2

.click() on that slider will click on the middle. If you want to click to the side, you can click using X, Y offsets. First get the width of the slider and then adjust your X coordinate accordingly. I used this trick (in C# anyway) for testing a "scrub bar" in a web video player by clicking on the second-to-last pixel of the slider and making sure the next video "auto-rolled".

Here is some sample code from SQA StackExhange:

Actions builder = new Actions(driver);   
builder.moveToElement(referenceElement, X, Y).click().build().perform();
1
  • it works.. thanks
    – Rush910
    May 30 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.