Ruby on rails Rails、Heroku、Watir:无法打开到127.0.0.1:9515的TCP连接
我正在运行一个部署到Heroku的rails应用程序。我已按照Watir的要求安装了两个构建包:Ruby on rails Rails、Heroku、Watir:无法打开到127.0.0.1:9515的TCP连接,ruby-on-rails,heroku,watir,sidekiq,Ruby On Rails,Heroku,Watir,Sidekiq,我正在运行一个部署到Heroku的rails应用程序。我已按照Watir的要求安装了两个构建包: https://github.com/heroku/heroku-buildpack-google-chrome https://github.com/heroku/heroku-buildpack-chromedriver 上面的包创建了一个GOOGLE\u CHROME\u SHIMenvironment配置,我将依次使用它- 以下是我当前设置Watir浏览器的代码: def browser
https://github.com/heroku/heroku-buildpack-google-chrome
https://github.com/heroku/heroku-buildpack-chromedriver
上面的包创建了一个GOOGLE\u CHROME\u SHIM
environment配置,我将依次使用它-
以下是我当前设置Watir浏览器的代码:
def browser
@browser ||= Watir::Browser.new(:chrome, browser_options)
end
def browser_options
if chromedriver_binary_path.present?
puts "path was present: #{chromedriver_binary_path}"
{
headless: true,
options: { binary: chromedriver_binary_path },
switches: [
'--ignore-certificate-errors',
'--disable-popup-blocking',
'--disable-translate',
'--disable-gpu'
]
}
else
{}
end
end
def chromedriver_binary_path
ENV['GOOGLE_CHROME_SHIM']
end
上面的代码位于从sidekiq worker调用的类中(因此代码在后台作业/我的sidekiq dyno上运行)
每当运行此代码时,都会发生以下情况:
2020-10-18T05:51:31.082352+00:00 app[sidekiq.1]: pid=4 tid=2ym8 WARN: Errno::ECONNREFUSED: Failed to open TCP connection to 127.0.0.1:9515 (Connection refused - connect(2) for "127.0.0.1" port 9515)
就我的一生而言,我无法让它发挥作用。我花了一周的时间在stackoverflow的帖子中寻找这个话题,但毫无结果。如果有人有任何想法或可以提供任何建议,我将非常欢迎尝试
编辑:我应该注意,我的put
语句输出以下路径:
2020-10-18T05:51:24.599171+00:00 app[sidekiq.1]: path was present: /app/.apt/usr/bin/google-chrome-stable
我还尝试过使用
webdrivers
gem并卸载chromedriver buildpack,但没有成功,如下所述:使用webdrivers解决方案,你能打开日志记录吗:Webdriver.logger.level=:debug
和Selenium::Webdriver.logger.level=:debug
我想确保Watir通过Selenium设置了正确的东西,并查看webdrivers的错误。使用webdrivers解决方案,您能否打开日志记录:Webdriver.logger.level=:debug
和Selenium::Webdriver.logger.level=:debug
我想通过Selenium确保Watir设置了正确的内容,并查看Webdriver的错误。