无法在 Mac OS X 10.5 上使用 watir-webdriver 驱动 Opera

发布于 2024-12-05 12:05:43 字数 4589 浏览 1 评论 0原文

我正在尝试在 Mac OS X 10.5 上使用 watir-webdriver 驱动 Opera

顺便提一下,我在 Mac OS X 10.6 上驱动它没有任何问题。此外,我还能够在 Mac OS X 10.5 上驱动 Internet Explorer、Firefox 和 Chrome。

它是经过完全修补的机器,Mac OS X 10.5.8,具有 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。

这就是我得到的:

$ 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 server] 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'

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 server] 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'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月光色 2024-12-12 12:05:43

“无法找到脚本注入的运行时”意味着当前激活的选项卡/文档不可进行脚本注入; OperaDriver 无法将 JavaScript 注入到文档中。

对于 Opera 中的某些类型的页面来说确实如此,例如“opera:about”和一些错误页面(想到的是不支持的协议)。

您可以手动打开 Opera(使用 -autotestmode 参数)并关闭所有打开的选项卡,然后重试吗?

(顺便说一句,这个问题不应该出现在 Opera 12(Opera 的下一个版本)中。)

有关更多上下文:http://code.google.com/p/selenium/issues/detail?id=2470

“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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文