Selenium / Watir TCP connection fails only on worker dyno heroku

前提是你 提交于 2019-12-24 20:54:46

问题


Why would watir only fail on a heroku worker node?

I'm trying to go to run a basic function of going to google.com. This works fine when I run it on a web dyno but fails when I use delayed job to run it on a worker.

The code is as follows

Selenium::WebDriver::Chrome.path = "/app/.apt/usr/bin/google-chrome"
Selenium::WebDriver::Chrome.driver_path = "/app/vendor/bundle/bin/chromedriver"
browser = Watir::Browser.new :chrome
browser.goto "google.com"

I then receive the following error:

Failed to open TCP connection to 127.0.0.1:9515 (Connection refused - connect(2) for "127.0.0.1" port 9515)

I'm using the heroku google chrome, and chromedriver buildpacks and my gemfile is

gem 'watir'
gem 'chromedriver-helper'
gem 'delayed_job_active_record'

I've used heroku ps:exec --dyno=worker.1 and run rails c and am able to run the same exact code and not receive the error which makes me belive that it's not an installation error. Why would this fail only on a worker node? And I'm also confused why it would work on a worker node with rails c.

来源:https://stackoverflow.com/questions/52188535/selenium-watir-tcp-connection-fails-only-on-worker-dyno-heroku

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!