How to get desired capabilities at runtime in Ruby?

I’m struggling to figure out the Ruby syntax to call on the caps Instance Attribute. I see it documented here but I can’t call it during my test.

The test runs, and does the following:

  1. Reads in a toml file of capabilities
  2. Appium::Driver.new(desired_caps).start_driver
  3. Appium.promote_appium_methods RSpec::Core::ExampleGroup

And then after that, if I attempt to print out the caps Instance Attribute then it blows up since it is unknown.

I tried:

driver.caps

and

caps

and

appium_driver.caps

I’m currently storing my desired_caps var as a global and using that, but that’s pretty gross and I’d prefer to use the documented way.

Capabilities I’m using:

[caps]
platformName = “Android”
platformVersion = “7.0”
deviceName = “Android 7.0 Emulator”
app = “./app-debug.apk”
avd = “Nexus_5X_API_24”
avdArgs = “-no-boot-anim”
newCommandTimeout = 30
rotatable = true
orientation = “PORTRAIT”

Ruby:

ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]

Appium:

appium 1.6.5

Appium Gem Versions:

appium_console (2.3.0)
appium_lib (9.4.9)

Thanks!

@mario_bianco did you find any work around?