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.sstatic.net/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. Commented May 27, 2021 at 17:23
  • Hey @LeeJensen.. added ss above Commented May 27, 2021 at 17:37

1 Answer 1

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();
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.