Safari not launching after when I open app first

I am automating some tests a real device (iOS) using Appium and Cucumber.
My idea it to do the following steps:

  • Open the app
  • Do some tasks
  • Launch Safari
  • Navigate to a website, lets say google.com for example

My approach is the following:

  • I create the Driver with my app capabilities
  • Do what I need
  • Clear the Driver
  • Create a new driver with Safari capabilities
  • Navigate to www.google.com

The code looks something like this:

Appium::Driver.new(app_capabilities, true)
# do what I need on the app
driver.driver_quit

Appium::Driver.new(browser_capabilities, true)
# do what I need on the browser
driver.driver_quit

The problem I am having is that Safari doesn’t launch. Although if I use only one Driver with the browser capabilities it does launch.

Anyone has any idea this is happening? Or maybe a better strategy?

I’m writing ruby but I don’t mind code in other languages.