开发者

Can not drive Opera with watir-webdriver on Mac OS X 10.5

开发者 https://www.devze.com 2023-04-05 22:11 出处:网络
I am trying to drive Opera with watir-webdriver on Mac OS X 10.5 Just to mention, I had no problems driving it on Mac OS X 10.6. Also, I was able to drive Internet Explorer, Firefox and Chrome on Mac

I am trying to drive Opera with watir-webdriver on Mac OS X 10.5

Just to mention, I had no problems driving it on Mac OS X 10.6. Also, I was able to drive Internet Explorer, Firefox and Chrome on Mac OS X 10.5.

It is fully patched machine, Mac OS X 10.5.8, with 4 GB RAM.

$ ruby -v
ruby 1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0]

$ gem -v
1.4.2

$ java -version
java version "1.5.0_30"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_30-b03-389-9M3425)
Java HotSpot(TM) Client VM (build 1.5.0_30-161, mixed mode)

Xcode 3.1.4, Opera 11.51, selenium-webdriver 2.6.0, selenium-server-standalone-2.6.0.jar, watir-webdriver 0.3.3.

This is what I get:

$ irb

>> require "watir-webdriver"
=> true

>> b = Watir::Browser.new :opera
Selenium::WebDriver::Error::UnhandledError: Could not find a runtime for script injection
Build info: version: '2.6.0', revision: '13840', time: '2011-09-13 14:55:30'
System info: os.name: 'Mac OS X', os.arch: 'i386', os.version: '10.5.8', java.version: '1.5.0_30'
Driver info: driver.version: OperaDriver (org.openqa.selenium.WebDriverException)
    from [remote server] com.opera.core.systems.scope.services.ums.EcmaScriptDebugger(EcmaScriptDebugger.java):164:in `init'
    from [remote server] com.opera.core.systems.ScopeServices(ScopeServices.java):274:in `initializeServices'
    from [remote server] com.opera.core.systems.ScopeServices(ScopeServices.java):250:in `init'
    from [remote server] com.opera.core.systems.OperaDriver(OperaDriver.java):360:in `init'
    from [remote server] com.opera.core.systems.OperaDriver(OperaDriver.java):339:in `start'
    from [remote server] com.opera.core.systems.OperaDriver(OperaDriver.java):293: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):501:in `newInstance'
    from [remote server] org.openqa.selenium.remote.server.DefaultDriverFactory(DefaultDriverFactory.java):88:in `callConstructor'
    from [remote server] org.openqa.selenium.remote.server.DefaultDriverFactory(DefaultDriverFactory.java):82:in `newInstance'
    from [remote server] org.openqa.selenium.remote.server.DefaultSession$BrowserCreator(DefaultSession.java):156:in `call'
    from [remote server] org.openqa.selenium.remote.server.DefaultSession$BrowserCreator(DefaultSession.java):1:in `call'
    from [remote se开发者_高级运维rver] java.util.concurrent.FutureTask$Sync(FutureTask.java):269:in `innerRun'
    from [remote server] java.util.concurrent.FutureTask(FutureTask.java):123:in `run'
... 3 levels...
    from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.6.0/lib/selenium/webdriver/remote/response.rb:45:in `assert_ok'
    from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.6.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
    from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.6.0/lib/selenium/webdriver/remote/http/common.rb:54:in `new'
    from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.6.0/lib/selenium/webdriver/remote/http/common.rb:54:in `create_response'
    from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.6.0/lib/selenium/webdriver/remote/http/default.rb:64:in `request'
    from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.6.0/lib/selenium/webdriver/remote/http/common.rb:35:in `call'
    from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.6.0/lib/selenium/webdriver/remote/bridge.rb:410:in `raw_execute'
    from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.6.0/lib/selenium/webdriver/remote/bridge.rb:88:in `create_session'
    from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.6.0/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
    from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.6.0/lib/selenium/webdriver/opera/bridge.rb:27:in `initialize'
    from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.6.0/lib/selenium/webdriver/common/driver.rb:41:in `new'
    from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.6.0/lib/selenium/webdriver/common/driver.rb:41:in `for'
    from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.6.0/lib/selenium/webdriver.rb:81:in `for'
    from /Library/Ruby/Gems/1.8/gems/watir-webdriver-0.3.3/lib/watir-webdriver/browser.rb:35:in `initialize'
    from (irb):2:in `new'


“Could not find a runtime for script injection” means that the currently activated tab/document isn't script injectable; that OperaDriver isn't able to inject JavaScript to the document.

This is true for certain types of pages in Opera, such as "opera:about" and some error pages (protocol not supported comes into mind).

Can you open Opera manually (with the -autotestmode argument) and close all open tabs, then try again?

(By the way, this problem shouldn't be present in Opera 12, the next version of Opera.)

For more context: http://code.google.com/p/selenium/issues/detail?id=2470

0

精彩评论

暂无评论...
验证码 换一张
取 消