我正在尝试使用Selenium RC打开safari。 但是,将创建Safari实例并保持请求连接模式 (SafariDriver在ws:// localhost:3078 / wd请求连接。)
require "selenium-webdriver"
caps = Selenium::WebDriver::Remote::Capabilities.safari
browser = Selenium::WebDriver.for :remote, :url=>"http://localhost:4444/wd/hub", :desired_capabilities=>caps
上面的东西挂了,失败了 -
Selenium :: WebDriver :: Error :: UnknownError:Executor尚未启动(java.lang.IllegalStateException)
来自[remote server] com.google.common.base.Preconditions(Preconditions.java):145:in checkState'
from [remote server] org.openqa.selenium.safari.SafariDriverCommandExecutor(SafariDriverCommandExecutor.java):123:in
execute'
来自[remote server] org.openqa.selenium.remote.RemoteWebDriver(RemoteWebDriver.java):432:in execute'
from [remote server] org.openqa.selenium.remote.RemoteWebDriver(RemoteWebDriver.java):140:in
startSession'
来自[remote server] org.openqa.selenium.remote.RemoteWebDriver(RemoteWebDriver.java):95:in <init>'
from [remote server] org.openqa.selenium.safari.SafariDriver(SafariDriver.java):33:in
'
来自[remote server] sun.reflect.NativeConstructorAccessorImpl(NativeConstructorAccessorImpl.java): - 2:in newInstance0'
from [remote server] sun.reflect.NativeConstructorAccessorImpl(NativeConstructorAccessorImpl.java):39:in
newInstance'
来自[remote server] sun.reflect.DelegatingConstructorAccessorImpl(DelegatingConstructorAccessorImpl.java):27:in newInstance'
from [remote server] java.lang.reflect.Constructor(Constructor.java):513:in
newInstance'
来自[remote server] java.lang.Class(Class.java):355:in newInstance0'
from [remote server] java.lang.Class(Class.java):308:in
newInstance'
来自[remote server] org.openqa.selenium.remote.server.DefaultDriverFactory(DefaultDriverFactory.java):61:in callConstructor'
from [remote server] org.openqa.selenium.remote.server.DefaultDriverFactory(DefaultDriverFactory.java):52:in
newInstance'
来自[remote server] org.openqa.selenium.remote.server.DefaultSession $ BrowserCreator(DefaultSession.java):197:in call'
from [remote server] org.openqa.selenium.remote.server.DefaultSession$BrowserCreator(DefaultSession.java):1:in
call'
...... 4级......
来自[remote server] java.util.concurrent.ThreadPoolExecutor $ Worker(ThreadPoolExecutor.java):908:in run'
from [remote server] java.lang.Thread(Thread.java):680:in
run'
来自/Users/demo/.rvm/gems/ruby-1.9.2-p180/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/response.rb:52:in assert_ok'
from /Users/demo/.rvm/gems/ruby-1.9.2-p180/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/response.rb:15:in
初始化“
来自/Users/demo/.rvm/gems/ruby-1.9.2-p180/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/http/common.rb:59:in {{1} } create_response”
来自/Users/demo/.rvm/gems/ruby-1.9.2-p180/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/http/default.rb:59:in {{1} }呼叫'
来自/Users/demo/.rvm/gems/ruby-1.9.2-p180/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/bridge.rb:598:in new'
from /Users/demo/.rvm/gems/ruby-1.9.2-p180/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/http/common.rb:59:in
create_session “
来自/Users/demo/.rvm/gems/ruby-1.9.2-p180/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/bridge.rb:68:in request'
from /Users/demo/.rvm/gems/ruby-1.9.2-p180/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/http/common.rb:40:in
new “
来自/Users/demo/.rvm/gems/ruby-1.9.2-p180/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/common/driver.rb:33:in raw_execute'
from /Users/demo/.rvm/gems/ruby-1.9.2-p180/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/bridge.rb:92:in
“
来自(irb):7
答案 0 :(得分:0)
使用Ruby的Selenium Webdriver时,我一直遇到这个问题。我解决了几次,但错误又回来了。所以我写了我的rspec测试,由jRuby在Windows上加载,并用Java运行Selenium调用。 Safari现在可以使用了。