ChromeDriver/Spinach/Selenium错误:无法从"窗口"中读取"localStorage"属性:在"data:"网址内禁用了存储空间

man*_*n88 9 selenium integration-testing ruby-on-rails selenium-chromedriver spinach

我的菠菜测试(Ruby on Rails)出错了.每个测试都因同样的原因失败:

<unknown>: Failed to read the 'localStorage' property from 'Window': Storage is disabled inside 'data:' URLs.
      (Session info: chrome=46.0.2490.86)
      (Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Mac OS X 10.10.5 x86_64)
Run Code Online (Sandbox Code Playgroud)

示例来自Spinach的测试步骤失败:

step 'I visit the site' do
  visit "/top?DEBUG_USER=#{$spinach_test_userid}"
  page.execute_script('localStorage.clear()') # clear localStorage and reload to act as fresh login
  visit "/top?DEBUG_USER=#{$spinach_test_userid}"
end
Run Code Online (Sandbox Code Playgroud)

想法?

设置包括RSpec,Capybara,菠菜,Chromedriver,Selenium.代码包括Mongo,Node.js,Rails ......

更新:意识到测试没有设置为在运行测试之前运行应用程序,因此它试图在没有正确访问页面的情况下找到本地存储("找不到页面").在单独的终端选项卡中手动运行应用程序解决了问题.将此问题留给下一个需要帮助的n00b.;-)

Cos*_*min 8

问题在于您在实际导航到 URL 之前尝试删除本地存储数据。

您的浏览器页面实际上与此处的屏幕截图类似。