I wish to use the capybara method drag_to in order to manually sort items on a page. Below is my code:
pos2 = find('#first_element')
target = find(#second_element)
pos2.drag_to(target)
However I get the error message:
undefined method `drag_to' for nil:NilClass (NoMethodError)
Am I invoking the method incorrectly? I am attempting to implement as defined here: http://rubydoc.info/gems/capybara/0.4.0/Capybara/Element#drag_to-instance_method
Please note I am able to use other capybara methods fill_in, visit etc without any problems...
Any help would be greatly appreciated!
pos2
is nil. That suggests you are not finding the first element correctly. It might help to show your actual code. – Justin Kofind('#second_element')
instead offind(#second_element)
– lifuspos2 = find(:xpath, '//*[@id="people_container"]/div[1]/img') target = find(:xpath, '//*[@id="people_container"]/div[3]/img') pos2.drag_to(target)
This does not cause an error but the elements are not moved. :-( – user1523236