Method: WebkitRemote::Browser#tabs

Defined in:
lib/webkit_remote/browser.rb

#tabsArray<WebkitRemote::Browser::Tab>

Retrieves the tabs that are currently open in the browser.

These tabs can be used to start debugging.



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/webkit_remote/browser.rb', line 61

def tabs
  http_response = @http.request Net::HTTP::Get.new('/json')
  tabs = JSON.parse(http_response.body).map do |json_tab|
    title = json_tab['title']
    url = json_tab['url']
    debug_url = json_tab['webSocketDebuggerUrl']
    Tab.new self, debug_url, title: title, url: url
  end
  # HACK(pwnall): work around the nasty Google Hangouts integration
  tabs.select do |tab|
    tab.url != 'chrome-extension://nkeimhogjdpnpccoofpliimaahmaaome/background.html'
  end
end