Chromedriver doesn’t run in tmux and here’s how to fix it

Aw, Snap ScreenshotIf you are attempting to run Selenium using the Chromedriver while in a tmux session, you may have encountered some issues with chromedriver.  Specifically, this error:

Aw, Snap!

Something went wrong while displaying this webpage. To continue, reload or go to another page.

If you’re seeing this frequently, trie these suggestions.

A simple solution is to just execute the Selenium jar in a shell session outside of your good friend, tmux.

java -jar ~/bin/selenium-server-standalone-2.33.0.jar -browserSessionReuse

One of my friends, however, alerted me to this article that has a solution:

  • Get Homebrew, if you don’t already have it.
  • brew install reattach-to-user-namespace
  • Add the following line to your .tmux.conf file: set-option -g default-command "reattach-to-user-namespace -l zsh" (replace zsh with bash if you use that)

This fix also resolves the issue that prevents pbcopypbpaste, etc from working in tmux!