管理以使用Mac 10.6.8配置其他所有内容以使用watir-webdriver,有关如何解决无效文件路径的任何建议吗?
$ irb
>> require "watir-webdriver"
=> true
>> browser = Watir::Browser.new :opera
Selenium::WebDriver::Error::UnknownError: Invalid file path: null (com.opera.core.systems.runner.OperaRunnerException)
from [remote server] com.opera.core.systems.runner.OperaRunnerSettings(OperaRunnerSettings.java):70:in `setBinary'
from [remote server] com.opera.core.systems.OperaDriver(OperaDriver.java):286:in
`<init>'
from [remote server] sun.reflect.NativeConstructorAccessorImpl(NativeConstructorAccessorImpl.java):-2:in `newInstance0'
from [remote server] sun.reflect.NativeConstructorAccessorImpl(NativeConstructorAccessorImpl.java):39:in `newInstance'
from [remote server] sun.reflect.DelegatingConstructorAccessorImpl(DelegatingConstructorAccessorImpl.java):27:in `newInstance'
from [remote server] java.lang.reflect.Constructor(Constructor.java):513:in `newInstance'
from [remote server] org.openqa.selenium.remote.server.DefaultDriverFactory(DefaultDriverFactory.java):63:in `callConstructor'
from [remote server] org.openqa.selenium.remote.server.DefaultDriverFactory(DefaultDriverFactory.java):57:in `newInstance'
from [remote server] org.openqa.selenium.remote.server.DefaultSession$BrowserCreator(DefaultSession.java):177:in `call'
from [remote server] org.openqa.selenium.remote.server.DefaultSession$BrowserCreator(DefaultSession.java):1:in `call'
from [remote server] java.util.concurrent.FutureTask$Sync(FutureTask.java):303:in `innerRun'
from [remote server] java.util.concurrent.FutureTask(FutureTask.java):138:in `run'
from [remote server] java.util.concurrent.ThreadPoolExecutor$Worker(ThreadPoolExecutor.java):886:in `runTask'
from [remote server] java.util.concurrent.ThreadPoolExecutor$Worker(ThreadPoolExecutor.java):908:in `run'
from [remote server] java.lang.Thread(Thread.java):680:in `run'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.15.0/lib/selenium/webdriver/remote/response.rb:50:in `assert_ok'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.15.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.15.0/lib/selenium/webdriver/remote/http/common.rb:58:in `new'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.15.0/lib/selenium/webdriver/remote/http/common.rb:58:in `create_response'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.15.0/lib/selenium/webdriver/remote/http/default.rb:64:in `request'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.15.0/lib/selenium/webdriver/remote/http/common.rb:39:in `call'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.15.0/lib/selenium/webdriver/remote/bridge.rb:450:in `raw_execute'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.15.0/lib/selenium/webdriver/remote/bridge.rb:92:in `create_session'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.15.0/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.15.0/lib/selenium/webdriver/opera/bridge.rb:28:in `initialize'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.15.0/lib/selenium/webdriver/common/driver.rb:43:in `new'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.15.0/lib/selenium/webdriver/common/driver.rb:43:in `for'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.15.0/lib/selenium/webdriver.rb:60:in `for'
from /Library/Ruby/Gems/1.8/gems/watir-webdriver-0.4.1/lib/watir-webdriver/browser.rb:35:in `initialize'
from (irb):2:in `new'
from (irb):2>>
答案 0 :(得分:1)
我现在没有Mac OS X 10.6方便,但我在10.7机器上跟着installation instructions,一切正常。 (我已经安装了 OSX GCC安装程序而不是 Xcode ,我已经从 App Store 安装了 Opera 。)< / p>
摆脱
Warning: multi_json is using default ok_json engine. Suggested action: require and load an appropriate JSON library.
后
browser = Watir::Browser.new :opera
安装json gem:
gem install json
或
sudo gem install json
答案 1 :(得分:0)
我不熟悉Ruby / Watir问题(但是)我很好奇为什么你将一个:opera符号传递给新方法?
browser = Watir :: Browser.new:opera
如果键入Opera.app的正确路径而不是:opera符号,它是否有效?