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)
我找不到我丢失的东西,请帮助我
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
最佳答案
尝试添加:
require 'rubygems'
在此脚本之上。如果仍然出现相同的错误,请安装 gem:
gem install selenium-webdriver
希望对您有所帮助。
关于ruby-on-rails - ruby/2.3.0/rubygems/core_ext/kernel_require.rb :55:in `require' : cannot load such file -- selenium-webdriver (LoadError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42342668/