require 'HTTParty' class AppiumServerClient def isSessionAlive?(session_url) uri = "#{session_url}/sessions" response = HTTParty.get(uri, headers: get_default_headers) sessions = JSON.parse(response.to_s) session_state = sessions["value"].empty? return !session_state end def get_default_headers headers = { 'Content-Type': "Application/json" } return headers end end