2017-02-20 35 views
1
I am trying to run this below code, then I got code error: 

紅寶石/ 2.3.0 /的rubygems/core_ext /kernel_require.rb:55:in`要求:不能加載這樣的文件 - 硒的webdriver(LoadError)紅寶石/ 2.3.0 /的rubygems/core_ext/kernel_require.rb:55:在`需要':不能加載這樣的文件 - 硒 - 的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 "[email protected]" 

#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 
+0

有很多可能的答案可以通過谷歌搜索。你能讓我們知道他們爲什麼不幫你嗎? – Burki

回答

0

嘗試加入:

require 'rubygems' 

在此腳本的頂部。如果你仍然得到同樣的錯誤,然後安裝寶石:

gem install selenium-webdriver 

希望它能幫助。

-1

當我收到「Kernel-require」錯誤時,我已經打開了多個項目。然後我在另一個窗口中打開了我的項目,並再次使用了require語句。 它爲我工作。

相關問題