How to switch between two drivers using ruby

Hi all,

I want to be able to switch between two drivers (one for a ios real device and one for a android real device) in order for them to interact during the test.

I’v search online and only got questions:
http://stackoverflow.com/questions/28454711/how-to-switch-between-multiple-appium-driver-instances-in-ruby
https://groups.google.com/forum/#!topic/appium-discuss/XxmV6IgQmFU

My current, one driver simplified ruby code is:

  class AppiumWorld
  end

  caps = Appium.load_appium_txt file: File.join('my_path', 'appium.txt'), verbose: true
  Appium::Driver.new(caps)
  Appium.promote_appium_methods AppiumWorld

  World do
      AppiumWorld.new
  end

  Before do
      $driver.start_driver
  end

  After do |scenario|
      $driver.driver_quit
  end

Any hint on how to accomplish this?

Hi,

I am not sure if this will help you but if I were in your situation, I would have Used threads.
Local variables would be my best choice to create appium instances as they are thread safe and have global scope within thread . I think for this you have to modify your setup function in spec_helper.rb(in case you are using page object model)

And you can use queue to communicate between threads.
Thread.txt (343 Bytes)

Thanks,
Donald

Well it seems it is still not possible:

Ruby coders? anyone want do work on the issue? :smiley: eh eh

Oh no… that is sad.
But please can you share why you wanna switch between drivers? This scenario seems interesting and may be it can benefit us all in real world situations once there is a solution to this problem statement.

Thanks,
Donald

I’m testing a chat application, so tests are all about interaction between two or more users each one in their device.

Currently I’m launching ios real device tests and in the middle of it when I need android to step up, I do a OS call to launch a different test that will launch android and confirm he has received the chat, send new content, etc.

Problem with this configuration is that lose lots and lots of time re-launching apps, while if they were all in same test and I could just switch device I believe I could save 30% of tests time at least.

Hello All,

Greetings!!

I am new to appium- Mobile Automation, trying to make a simple mobile browser automation demo. My goal is to use appium with capybara along with Ruby, so that the appium inherits all capybara DSL. Please can you help me with any sample code, so that it can help me with start up. It will be a great help.

Thanks.