我正在尝试使用 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 has not been started yet (java.lang.IllegalStateException) from [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' from [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' from [remote server] org.openqa.selenium.remote.RemoteWebDriver(RemoteWebDriver.java ):95:in <init>'
from [remote server] org.openqa.selenium.safari.SafariDriver(SafariDriver.java):33:in
'来自 [远程服务器] sun.reflect.NativeConstructorAccessorImpl(NativeConstructorAccessorImpl.java):-2:in newInstance0'
from [remote server] sun.reflect.NativeConstructorAccessorImpl(NativeConstructorAccessorImpl.java):39:in
newInstance' 来自 [远程服务器] sun.reflect.DelegatingConstructorAccessorImpl(DelegatingConstructorAccessorImpl.java):27:in newInstance'
from [remote server] java.lang.reflect.Constructor(Constructor.java):513:in
newInstance' 来自[远程服务器] java.lang.Class(Class.java):355:innewInstance0'
from [remote server] java.lang.Class(Class.java):308:in
newInstance' 来自 [远程服务器] 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' 来自 [远程服务器] 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 个级别...来自 [远程服务器] 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
initialize' 来自 /Users/demo/.rvm/gems/ruby- 1.9.2-p180/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/http/common.rb:59:innew'
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
来自/Users/demo/.rvm/gems/ruby-1.9.2-p180/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/http/default.rb:59: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
call 的 create_response'来自 /Users/demo/.rvm/gems/ruby-1.9.2-p180/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/bridge.rb:598: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
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 initialize'
from /Users/demo/.rvm/gems/ruby-1.9.2-p180/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/common/driver.rb:33: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 for'
from /Users/demo/.rvm/gems/ruby-1.9.2-p180/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver.rb:65:in
for' from (irb):7