小编SoA*_*Man的帖子

无法在Mac上设置ruby-selenium Webdriver

我一直在使用selenium IDE.现在我们决定使用Selenium webdriver和Ruby.我对如何设置Mac,Mac Pro Yosemite 10.10.5感到困惑.

在我的终端中,我运行了以下命令:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew doctor
Your system is ready to brew.
$ brew install ruby
  ==> Summary
  /usr/local/Cellar/openssl/1.0.2d_1: 464 files, 18M
==> Installing ruby
==> Downloading https://homebrew.bintray.com/bottles/ruby-2.2.3.yosemite.bottle.100.0%
==> Pouring ruby-2.2.3.yosemite.bottle.tar.gz
    /usr/local/Cellar/ruby/2.2.3: 1080 files, 20M

$ ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]

$ sudo gem install selenium-webdriver
   Done installing documentation for websocket, ffi, childprocess, rubyzip, multi_json, selenium-webdriver after 25 seconds
6 gems installed
Run Code Online (Sandbox Code Playgroud)

我将从IDE记录的脚本导出到Ruby脚本中:export as ruby/rspec/webdriver …

ruby macos homebrew rvm

6
推荐指数
1
解决办法
841
查看次数

在应用程序中需要 Sinatra Gem 时出现 LoadError

我正在关注教程http://learnrubythehardway.org/book/ex50.html,它提供了:

创建尽可能最基本的 Sinatra 应用程序。将以下代码放入bin/app.rb

require 'sinatra'

set :port, 8080
set :static, true
set :public_folder, "static"
set :views, "views"

get '/' do
    return 'Hello world'
end
Run Code Online (Sandbox Code Playgroud)

我安装了 gem 和 Sinatra 没有任何问题。我还将教程中的内容复制app.rb到本地bin/app.rb文件中。

我运行它:ruby bin/app.rb

终端输出:

/home/t/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in 'require': cannot load such file -- sinatra (LoadError)
    from /home/t/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in 'require'
    from bin/app.rb:1:in `<main>
Run Code Online (Sandbox Code Playgroud)

当我运行时rake test它通过了测试。有什么问题?

ruby sinatra learn-ruby-the-hard-way

0
推荐指数
1
解决办法
2501
查看次数

标签 统计

ruby ×2

homebrew ×1

learn-ruby-the-hard-way ×1

macos ×1

rvm ×1

sinatra ×1