…if you want to call hacking Watir to work with certain “advanced” UI elements that!
Element in the works: jQuery UI’s Slider
There’s nothing straightforward in Watir to change the slider and trigger the events as if the user interacted with the slider. In a normal slider implementation, that would either be the ‘change’ or ‘stop’ events on the slider. So how do you do that? Use the execute_script to directly do what you need via javascript.
1 2 3 |
|
event and ui are objects you can self-create and send to the caller since your call handler signature would’ve been
1 2 3 |
|
Now that you know the js, you can simply execute it on the watir’s ‘browser’ instance
Solution:
1
|
|
Lesson: Watir can be hacked to work even with complex and dynamic web pages ;-)