2017-08-01 47 views
0

我已經寫了一小段代碼,只是推出了瀏覽器,但我得到這個錯誤:頂端所需錯誤 - 無法執行代碼

C:/Users/KASTURIPARIDA/RubymineProjects/Project1/features/support/driversettings.rb:6:in <top (required)>' C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.17/bin/cucumber:13:in ' C:/Ruby193/bin/cucumber:23:in load' C:/Ruby193/bin/cucumber:23:in ' -e:1:in `load'

這裏下面是所有的代碼:

支持:

require 'rubygems' 
require 'watir-webdriver' 

Selenium::WebDriver::Chrome::Service.executable_path = 'C:\Ruby193\bin\chromedriver.exe' 

$driver=watir::Browser.new :Chrome 

wait 5 

特點:

Feature: Application 
    Scenario: Login to Open 
    And I have account with Opencart and launch page 

步驟定義:

And(/^I have account with Opencart and launch page$/) do 
    puts "browser loading" 
    $driver.goto("https://www.facebook.com/") 
end 

回答

0

試試這個:

支持

require 'rubygems' 
require 'watir' 

Selenium::WebDriver::Chrome.driver_path = 'C:\Ruby193\bin\chromedriver.exe' 

$driver = Watir::Browser.new('chrome') 

希望它能幫助。

+0

沒有工作。可能是其他問題。 – kasturi

+0

@kasturi,你得到什麼錯誤? –