Richard Paul
unread,Jul 12, 2011, 10:07:41 AM7/12/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to selenium-ruby
I have some webdriver-0.2 code that acts as test helpers for
manipulating custom widgets:
class SliderWidget
def initialize(element)
@element = element
end
def drag_to(percentage)
position = calculate_position_in_pixels(percentage)
@element.drag_and_drop_by(position - current_position, vertical=0)
end
...
end
I'm attempting to port this over to webdriver-2.0 but
element.drag_and_drop_to has been removed and replaced with action
builder. ActionBuilder requires the driver as the base element, e.g.
driver.action.drag_and_drop_to(@element, position - current_position,
vertical=0)
However my SliderWidget shouldn't need to know about the entire
driver, just the element it wants to interact with (Law of Demeter).
Does anyone know of an elegant solution to this in selenium-
webdriver-2.0? Or will I have to pass the driver in each time I
instantiate a draggable widget helper.