简体   繁体   English

ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': 无法加载此类文件 -- selenium-webdriver (LoadError)

[英]ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- selenium-webdriver (LoadError)

I am trying to run this below code, then I got code error:

ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- selenium-webdriver (LoadError) ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': 无法加载此类文件 -- selenium-webdriver (LoadError)

I am not able to find what I am missing please help me with this我无法找到我缺少的东西,请帮我解决这个问题

require "selenium-webdriver"

# Firefox browser instantiation
driver = Selenium::WebDriver.for :firefox

#Loading the assertselenium URL
driver.navigate.to "http://www.assertselenium.com"

#Clicking on the Follow link present on the assertselenium home page
FollowButton  = driver.find_element(:link, "Follow")
FollowButton.click

#Typing the UserName
LoginButton = driver.find_element(:id, "user_login")
LoginButton.send_keys "sampleuser77dff27"

#Typing the Email-Id
EmailId = driver.find_element(:id, "user_email")
EmailId.send_keys "sampleuser7f7df27@gmail.com"

#Clicking on the Submit Button
SubmitButton = driver.find_element(:id, "wp-submit")
SubmitButton.click

#Asserting whether the registration success message is diaplyed
SuccessMessage = driver.find_element(:css, "p.message")
"Registration complete. Please check your e-mail.".eql? SuccessMessage.text
puts "Successfully completed the user registration and validated the Success message"
#Quitting the browser
driver.quit

Try add:尝试添加:

require 'rubygems'

on top of this script.在这个脚本之上。 If you still get the same error, then install the gem:如果您仍然遇到相同的错误,请安装 gem:

gem install selenium-webdriver

Hope it helps.希望能帮助到你。

I resolved that issue, but my condition in that time was the project didn't run any command related to install or update gems, and throw a message complain me to update new version of an installed gem (sprockets).我解决了这个问题,但当时我的情况是该项目没有运行任何与安装或更新 gems 相关的命令,并抛出一条消息抱怨我更新已安装 gem (sprockets) 的新版本。 So, next are the steps I followed:所以,接下来是我遵循的步骤:

  1. Uninstall bundler with the actual version that ruby you are using by using: gem uninstall bundler使用您正在使用的 ruby​​ 的实际版本gem uninstall bundlergem uninstall bundler

  2. Install bundler, this will make install the newest version bundler, using : gem install bundler安装 bundler,这将使安装最新版本的 bundler,使用: gem install bundler

  3. Update all your installed gems of the project by using: bundle update使用以下命令bundle update项目的所有已安装 gem: bundle update

  4. And for just in case: bundle install以防万一: bundle install

I had opened multiple projects when I got "Kernel-require" error.当我收到“Kernel-require”错误时,我打开了多个项目。 Then I opened my project in a separate window and I used the require statement again.然后我在一个单独的窗口中打开了我的项目,我再次使用了 require 语句。 It worked for me.它对我有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:在'require'中:无法加载此类文件-watir(LoadError) - C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file — watir (LoadError) lib / bootsnap / load_path_cache / core_ext / kernel_require.rb:21:在'require'中:无法加载此类文件— sass(LoadError) - lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require': cannot load such file — sass (LoadError) 错误 `require' /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': 不能 - error `require' /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot 软件包安装错误后,kernel_require.rb:55:在'require'中:无法加载此类文件—捆绑程序(LoadError) - after bundle install error kernel_require.rb:55:in `require': cannot load such file — bundler (LoadError) kernel_require.rb:15:in `require': 无法加载此类文件 -- 3.0/pg_ext (LoadError) - kernel_require.rb:15:in `require': cannot load such file -- 3.0/pg_ext (LoadError) Ruby错误kernel_require.rb:55:在'require'中:无法加载此类文件— ec2 / amitools / version - Ruby error kernel_require.rb:55:in `require': cannot load such file — ec2/amitools/version kernel_require.rb:无法加载此类文件 - kernel_require.rb: cannot load such file /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:在'require'中:无法加载此类文件-cassandra(LoadError) - /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file — cassandra (LoadError) 未加载库:rubygems/core_ext/kernel_require - Not loading library : rubygems/core_ext/kernel_require Ruby错误'require':无法加载此类文件-bcrypt_ext(LoadError) - Ruby Error `require': cannot load such file — bcrypt_ext (LoadError)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM