我正在尝试为 chrome 启动远程会话并不断遇到同样的问题。剧本没那么复杂。我想知道是否不是某些可能设置不正确的开关。下面是我正在使用的一段代码以及我正在返回的错误(或其中的一部分,很长)。我看到浏览器尝试打开然后立即关闭。
require "selenium-webdriver"
require "test/unit"
class PageLinks < Test::Unit::TestCase
def setup
@caps = Selenium::WebDriver::Remote::Capabilities.chrome
@caps['chrome.switches'] = %w[--ignore-certificate-errors]
@driver = Selenium::WebDriver.for( :remote, :url => 'http://localhost:4444/wd/hub', :desired_capabilities => @caps )
@driver.manage.timeouts.implicit_wait = 200
@driver.manage.timeouts.page_load = 200
@wait = Selenium::WebDriver::Wait.new(:timeout => 200)
@verification_errors = []
end
def teardown
@driver.quit
end
def test_pagelinks
@driver.get('http://www.yahoo.com')
@driver.find_element(:link, "HOME").click
……
test_pagelinks(PageLinks):
Selenium::WebDriver::Error::UnknownError: [GET, HEAD, DELETE]
Command duration or timeout: 2 milliseconds
Build info: version: '2.20.0', revision: '16008', time: '2012-02-27 19:03:04'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_03'
Driver info: driver.version: RemoteWebDriver (org.openqa.selenium.UnsupportedCommandException)
[remote server] sun.reflect.NativeConstructorAccessorImpl():-2:in `newInstance0'
[remote server] sun.reflect.NativeConstructorAccessorImpl():-1:in `newInstance'
…………