I'm testing real device with Appium and Ruby.
I have a question about session closing.
I want to execute a script on 2 devices.
-Go to specific Url.
Right now, I have to put "driver.quit" between the 2 sessions because I change the capabilities and I create a new driver. If I don't put "driver.quit" Appium told me that a session is already running.
But when I do "driver.quit", the browser close itself.
Thanks a lot.
capabilities =
{
'deviceName' => 'Galaxy S4',
'udid' => 'xxxxxx',
'platformName'=> 'Android',
'browserName'=> 'Chrome'
}
#Setup webdrivers to talk to Appium and mobile browser and use implicit_waits to poll with long timeout to see if pages are loaded
driver = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => server_url)#, :profile => profile)
browser = Watir::Browser.new driver
browser.driver.manage.timeouts.implicit_wait = 30
puts "new ANDROID Watir browser object instantiated"
#automated browser code using Watir browser object and methods
browser.screenshot.save("Galaxy S5.png")
driver.quit
capabilities2 =
{
'deviceName' => 'Galaxy S2',
'udid' => 'dddddd',
'platformName'=> 'Android',
'browserName'=> 'Chrome'
}
#Setup webdrivers to talk to Appium and mobile browser and use implicit_waits to poll with long timeout to see if pages are loaded
driver2 = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities2, :url => server_url)#, :profile => profile)
browser2 = Watir::Browser.new driver2
browser2.driver.manage.timeouts.implicit_wait = 30
puts "new ANDROID Watir browser object instantiated"
#automated browser code using Watir browser object and methods
browser2.screenshot.save("Galaxy S4.png")