rubyseleniumwebdrivercapybaracapybara-webkit

How to access selenium rotation= from capybara


I am trying to access the rotation= definition and my IDE (RubyMine) does show it has the correct path there with this line and I can read the rotatable.rb file that it lives in.

page.driver.browser.rotation = :portrait

I also tried

Capybara.current_session.driver.browser.rotation = :portrait

But when it runs I get this error

undefined method `rotation=' for #<Selenium::WebDriver::Chrome::Driver:0x00007fc80a90b210> (NoMethodError)

I have checked the docs here, as well. https://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/DriverExtensions/Rotatable

Any advice on what I am doing incorrectly?


Solution

  • The only driver the Rotatable module is included into is the remote driver (Selenium::WebDriver::Remote::Driver) - https://github.com/SeleniumHQ/selenium/blob/master/rb/lib/selenium/webdriver/remote/driver.rb#L31 - so that's the only one the rotation= method is supported in. You are using the local chrome driver (Selenium::WebDriver::Chrome::Driver) where the method is not supported/implemented.