Attach to a manually opened Chrome browser using debuggerAddress


Watir-Classic can attach to manually opened browsers. This is a great benefit when using Watir to aid manual testing efforts. It is also helpful when developing automated tests. However, for the longest time, this was not possible with Watir(-Webdriver).

The ChromeOptions page mentions a debuggerAddress option:

An address of a Chrome debugger server to connect to, in the form of , e.g. ‘’

Can we use this option to attach to manually opened browsers?


From Issue 710, I was able to attach to a browser using the following steps:

  1. Close all Chrome browsers
  2. Manually start Chrome using chrome.exe --remote-debugging-port=8181 (any port number will do, but it must be used to open the first window)
  3. In the Watir script, initialize the browser using the debuggerAddress option with the same port:
    require 'watir'
    browser =
      'chromeOptions' => {'debuggerAddress': ''})


Unfortunately, ChromeDriver mentions that there are some limitations. For example, maximizing the browser is not supported:

#=> Selenium::WebDriver::Error::UnknownError: 
#=>   unknown error: operation is unsupported with remote debugging

While I need to investigate which commands are not supported, it looks promising. At least the manual testing scripts tested so far, which include navigation and form filling, work.

This entry was posted in Watir, Watir-Webdriver and tagged , , . Bookmark the permalink.

One Response to Attach to a manually opened Chrome browser using debuggerAddress

  1. joe strain says:

    great piece of info. I’ve missed the ability to attach and debug

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s