Hi Karthik,
I am using two android devices to test chrome broswer parallel, but if i open second instance of chromein the second device first instance is killing, though i am starting two different appium servers on two different ports.
command to start appium servers:
appium -p 4724 -bp 4726 -U EGxxxxxxxxx
appium -p 4723 -bp 4725 -U EGxxxxxxxxx
code: ( using ruby)
driver initilization:
def setup_appium_for_ne_on_android
Capybara.app_host = âhttps:/abcd.comâ
Capybara.server_port = 3001
Capybara.always_include_port = false
Capybara.default_selector = :css
Capybara.default_wait_time = 20
register_appium_android
Capybara.default_driver = :chrome
end
def register_appium_android
Capybara.register_driver(:chrome) do |app|
appium_lib_options = {
server_url: âhttp://127.0.0.1:4723/wd/hubâ
}
all_options = {
appium_lib: appium_lib_options,
caps: desired_caps_android
}
Appium::Capybara::Driver.new(app, all_options)
end
end
def desired_caps_android
{
platformName: âandroidâ,
platformVersion: â4.4.2â,
deviceName: âAndroidâ,
browserName: âChromeâ,
appActivity: âcom.google.android.apps.chrome.Mainâ,
appPackage: âcom.android.chromeâ,
}
end
Could you help me on how to switch between the sessions without killing the previous session.
Appium server1 log:
info: [debug] Proxied response received with status 200: {âsessionIdâ:â9990a8335794fedfb1dbbe4bb0a32213â,âstatusâ:0,âvalueâ:[{âELEMENTâ:â0.01748935179784894-3â}]}
info: <-- POST /wd/hub/session/9990a8335794fedfb1dbbe4bb0a32213/elements 200 82.021 ms - 105
info: --> GET /wd/hub/session/9990a8335794fedfb1dbbe4bb0a32213/element/0.01748935179784894-3/displayed {}
info: [debug] Proxying command to 127.0.0.1:9515
info: [debug] Making http request with opts: {âurlâ:âhttp://127.0.0.1:9515/wd/hub/session/9990a8335794fedfb1dbbe4bb0a32213/element/0.01748935179784894-3/displayed",âmethodâ:"GETâ}
info: [debug] Proxied response received with status 200: â{âsessionIdâ:â9990a8335794fedfb1dbbe4bb0a32213â,âstatusâ:0,âvalueâ:true}â
info: <-- GET /wd/hub/session/9990a8335794fedfb1dbbe4bb0a32213/element/0.01748935179784894-3/displayed 200 90.443 ms - 72
info: --> DELETE /wd/hub/session/9990a8335794fedfb1dbbe4bb0a32213 {}
info: Shutting down appium session
info: [debug] [BOOTSTRAP] [debug] Got data from client: {âcmdâ:âshutdownâ}
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] [BOOTSTRAP] [debug] Returning result: {âvalueâ:âOK, shutting downâ,âstatusâ:0}
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 99.774
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] Sent shutdown command, waiting for UiAutomator to stopâŚ
info: [debug] UiAutomator shut down normally
info: [debug] Killing chromedriver
info: [debug] Chromedriver exited with code null
info: [debug] (killed by signal SIGTERM)
info: [debug] executing cmd: /home/jitendra/Softwares/android-sdk-linux_x86/platform-tools/adb -s EGxxxxxxxxx shell âam force-stop com.android.chromeâ
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] Cleaning up appium session
info: [debug] Responding to client with success: {âstatusâ:0,âvalueâ:null,âsessionIdâ:â9990a8335794fedfb1dbbe4bb0a32213â}
info: <-- DELETE /wd/hub/session/9990a8335794fedfb1dbbe4bb0a32213 200 526.796 ms - 72 {âstatusâ:0,âvalueâ:null,âsessionIdâ:â9990a8335794fedfb1dbbe4bb0a32213â}
Appium server2 log:
info: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe)
info: Appium REST http interface listener started on 0.0.0.0:4724
info: [debug] Non-default server args: {âudidâ:âEGxxxxxxxxxxxâ,âportâ:4724,âbootstrapPortâ:4726}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {âdesiredCapabilitiesâ:{âplatformNameâ:âandroidâ,âplatformVersionâ:â4.4.2â,âdeviceNameâ:âAndroidâ,âbrowserNameâ:âChromeâ,âappActivityâ:âcom.google.android.apps.chrome.Mainâ,âappPackageâ:âcom.android.chromeâ}}
info: Client User-Agent string: Ruby
info: Set mode: Proxying straight through to Chromedriver
info: [debug] Looks like we want chrome on android
info: [debug] Creating new appium session 76caa26e-6706-4b81-87db-c06a2b73c4cc
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming itâs already on the device
info: [debug] Checking whether adb is present
info: [debug] Using adb from /home/android-sdk-linux_x86/platform-tools/adb
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devicesâŚ