在测试文件中,水豚方法save_and_open_page
显示错误:
错误:未指定显示
找不到合适的网络浏览器!
将BROWSER环境变量设置为所需的浏览器。
警告:程序返回非零退出代码#1
使用Firefox Web浏览器打开“/home/ubuntu/workspace/tmp/capybara/capybara-201604201009291019595495.html”(文本/ html)
Error: no display specified
/usr/bin/xdg-open: 461: /usr/bin/xdg-open: links2: not found
/usr/bin/xdg-open: 461: /usr/bin/xdg-open: links: not found
/usr/bin/xdg-open: 461: /usr/bin/xdg-open: lynx: not found
/usr/bin/xdg-open: 461: /usr/bin/xdg-open: w3m: not found
xdg-open: no method available for opening '/home/ubuntu/workspace/tmp/capybara/capybara-201604201009291019595495.html'
的Gemfile
group :development, :test do
gem 'pry-rails'
gem 'factory_girl_rails'
gem 'rspec-rails'
gem 'launchy'
end
group :development do
gem 'better_errors'
gem "letter_opener"
gem 'byebug'
gem 'pry-byebug'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'annotate'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
group :production do
gem 'rack-cache', :require => 'rack/cache'
end
group :test do
gem 'shoulda-matchers'
gem 'capybara'
end
如何设置浏览器chrome?
答案 0 :(得分:2)
xdg-open
命令在您的设置中没有配置默认浏览器。您可以通过以下方式验证:
$ xdg-settings get default-web-browser
# (probably will not print anything)
要为xdg-open
设置默认浏览器,请运行以下命令:
$ xdg-settings set default-web-browser google-chrome.desktop
如果这样做无效,请尝试搜索为Google Chrome定义的所有.desktop
个文件:
$ locate .desktop | grep chrome
选择其中一个并将其提供给上面的xdg-settings
命令(没有路径,只有带有.desktop
扩展名的文件名。)
您可以尝试从命令行打开链接来测试它:
$ xdg-open http://google.com
有关详细信息,请参阅xdg-settings
man page。