WWW::Mechanize::Chrome::Troubleshooting - Things to watch out for


Chrome is installed but Perl does not connect to it

If you notice that tests get skipped and/or the module installs but "does not seem to work", most likely you need to close ALL your Chrome windows. If you want Perl to share your browser, you will need to start Chrome yourself with the <--remote-debugging-port=9222> command line switch.

Tests fail with URLs that do not appear in the distribution files

If you notice that tests ( most likely, t/51-mech-links.t ) fail with URLs that are not on localhost or, another not entirely unlikely explanation is that your machine or your browser has been infected by some "Search Plugin" redirector which exfiltrates your browsing history or redirects your search engine or banking websites to other websites.

For confirmation and/or finding out how to remove the offender, maybe a search from a different machine for the URLs injected additionally into the test pages helps you identify the offender.


Chrome / Chromium best practices

Install your own version of Chrome/Chromium locally and disable automatic updates. This prevents the API from changing under your scripts.

File downloads don't work

Chrome / Chromium doesn't have an API for determining whether a download completed or not. Chrome versions v62 and v63 do have working downloads, but Chrome v64 does not send the appropriate API messages.

Timeout when launching script while Chrome is running

You get the error message

  Timeout while connecting to localhost:9222. Do you maybe have a non-debug
  instance of Chrome already running?

Most likely you already launched the Chrome binary without supplying the --remote-debugging-port option. Either stop all Chrome instances and (re)launch them using the --remote-debugging-port on the command line or launch a separate Chrome session using a separate data directory using the data_directory option.

Lost UI shared context

When Chrome is run in headless mode, Chrome throws a Lost UI shared context error. This error can be ignored and does not affect the operation of this module.


Ideally you ask your question on the public support forum, as then other people can also provide you with good answers. Your question should include a short script of about 20 lines that reproduces the problem. Remember to remove all passwords from the script.


The public repository of this module is


The public support forum of this module is


Please report bugs in this module via the Github bug queue at


Max Maischein


Copyright 2010-2021 by Max Maischein


This module is released under the same terms as Perl itself.