Method: AX::ScrollArea#scroll_to
- Defined in:
- lib/ax/scroll_area.rb
#scroll_to(element)
This method returns an undefined value.
Scroll through the receiver until the given element is visible.
If you need to scroll an unknown amount of units through a scroll area, or something in a scroll area (i.e. a table), you can just pass the element that you are trying to get to and this method will scroll to it for you.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ax/scroll_area.rb', line 22 def scroll_to element return if NSContainsRect(self.bounds, element.bounds) Mouse.move_to self.to_point # calculate direction to scroll direction = element.position.y > self.position.y ? -5 : 5 until NSContainsRect(self.bounds, element.bounds) Mouse.scroll direction end sleep 0.1 end |