How to close a sessin without closing the browser

66 views
Skip to first unread message

Eric

unread,
Aug 19, 2014, 12:25:37 PM8/19/14
to appium-...@googlegroups.com
Hello,
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.
- Start the browser on device 1
- Go to specific Url
-Start the browser on device 2
-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.
Purpose of the test is to display the wbepage on both devices... 
Do you have an idea to close the session without closing the browser ?
Thanks a lot.

My code :

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.goto "http://myurl.com"
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.goto "http://myurl.com"
browser2.screenshot.save("Galaxy S4.png")

Eric

unread,
Aug 20, 2014, 10:51:28 AM8/20/14
to appium-...@googlegroups.com
Any help on this ? :)
Thanks

Eric

unread,
Aug 22, 2014, 10:47:29 AM8/22/14
to appium-...@googlegroups.com
Really, nobody ? :(

Saimadhu G

unread,
Aug 23, 2014, 11:49:52 AM8/23/14
to appium-...@googlegroups.com
Eric,

Appium do not support running on multiple devices in 1 session.
If you want to execute tests in parallel on multiple devices then open multiple appium sessions.

Thanks
Saimadhu
Reply all
Reply to author
Forward
0 new messages