'Ruby - Appium (android) webdriver actions throws "NoMethodError: undefined method `perform_actions' for nil:NilClass"

I saw that touch actions are now deprecated and the recommendation is to use webdriver actions instead. I've been following the exact example from: https://appium.io/docs/en/commands/interactions/actions/index.html

Code:

f1 = ::Selenium::WebDriver::Interactions.pointer(:touch, name: 'finger1')
f1.create_pointer_move(duration: 1, x: 200, y: 500, origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
f1.create_pointer_down(:left)
f1.create_pause(0.5)
f1.create_pointer_move(duration: 1, x: 200, y: 200, origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
f1.create_pointer_up(:left)

f2 = ::Selenium::WebDriver::Interactions.pointer(:touch, name: 'finger2')
f2.create_pointer_move(duration: 1, x: 200, y: 500, origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
f2.create_pointer_down(:left)
f2.create_pause(0.5)
f2.create_pointer_move(duration: 1, x: 200, y: 800, origin: ::Selenium::Web@Driver::Interactions::PointerMove::VIEWPORT)
f2.create_pointer_up(:left)

@driver.perform_actions [f1, f2]

But for some reason when I run it I get "NoMethodError: undefined method `perform_actions' for nil:NilClass" for the last line that performs both actions => "@driver.perform_actions [f1, f2]"

If anybody knows an easier way in Ruby to rotate an item on screen (ex: google maps) by using two-finger touch, without using webdriver, that would also work.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source