title: How to run RSelenium script in Heroku
body: <p>I've been struggling to run an R script on Heroku with RSelenium. I have other scripts running on the platform, but I can't make a Selenium server start. I'm trying it using the help I found
  <a href="https://stackoverflow.com/questions/41059144/running-chromedriver-with-python-selenium-on-heroku">here on stackoverflow</a>. I have Google Chrome and ChromeDriver added to my Heroku slug. I managed to pull up the following code:</p>
  <pre><code>eCaps &lt;- list(chromeOptions = list(args = c('--headless', '--disable-gpu', '--blink-settings=imagesEnabled=false',
                                             '--disable-dev-shm-usage', '--no-sandbox', '-Dwebdriver.chrome.driver=/app/.chromedriver/bin/chromedriver'),
                                     binary = Sys.getenv(&quot;GOOGLE_CHROME_BIN&quot;)))
  remDr &lt;- remoteDriver(
   browser = &quot;chrome&quot;,
   extraCapabilities = eCaps
  )
  
  remDr$open()
  </code></pre>
  <p>where I have an environment variable <code>GOOGLE_CHROME_BIN</code> storing the path of the Chrome binary as <code>/app/.apt/usr/bin/google-chrome</code>.</p>
  <p>When I run the script I'm getting the following error:</p>
  <pre><code>[1] &quot;Connecting to remote server&quot;
  Error in checkError(res) : 
    Undefined error in httr call. httr output: Failed to connect to localhost port 4444: Connection refused
  Calls: &lt;Anonymous&gt; -&gt; queryRD -&gt; checkError
  </code></pre>