How we automate the slider with Robot Framework
What slider???
We still need more information about what you are trying to automate.
Some examples:
What SUT are you trying to automate/test?
What libraries are you trying to use?
What have you tried so far?
etc…
Its very difficult to help unless we have more information.
Hi Phoenix,
Those sliders look suspiciously like these ones?:
Is that what they are? If so it raises more questions:
- Does your AUT use jqueryui? and have you confirmed this with the app devs?
- As @Endo said which library are you using?
- bear in mind that a “slider” is not a standard html element
- so however it’s implemented in your app will be a custom solution, so unless your app is using this jqueryui library then a solution that works for this may not work for your app
- there will not be a “move slider to value” type keyword in any library, so you will need to create one
Looking at the html for one of these (screen shot below), the slider button’s position is controlled by the left: nn%
style element, but when you release it it updates both the style of the span and div elemnts, so it’s likely your solution is probably going to involve a mouse keyword, or a javascript call
Without knowing which library it’s not really possible to give a better answer than this,
Dave.
Hi,
As Dave said, it will probably end with a custom solution.
I have some of this, and end up on my side to evaluate the percent/xposition I need according to the element size (Seleniumlibrary).
Then I use this with a Click:
Click Element At Coordinates //div[@class='theclass'] xposition 0
Usually the size is fixed so I already know which xposition value I will provide, but It can be done dynamically by retrieving element size.
I came to this solution as sometimes the Javascript call set the cursor where you want, but doesn’t update the linked value/status. And finally this seems more a user way to do it.
Regards
Charlie
Purpose -I am doing it for practice because it will be useful to me in future projects.
Library - Selenium Library
robotframework 6.1.1
robotframework-seleniumlibrary 6.2.0
selenium 4.16.0