Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ChromeDriver/Spinach/Selenium error: Failed to read the 'localStorage' property from 'Window': Storage is disabled inside 'data:' URLs

I am getting an error with my spinach tests (Ruby on Rails). Every test fails for the same reason:

<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)

Example failing test step from 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

Ideas?

Set-up includes RSpec, Capybara, Spinach, Chromedriver, Selenium. Code includes Mongo, Node.js, Rails...

UPDATE: Realized that the tests were not set up to run the app before running the test, so it was trying to find local storage without having correctly visited the page first ('page not found'). Running app manually in a separate terminal tab solved the problem. Leaving this question up for next n00b who needs help. ;-)

like image 416
mandysimon88 Avatar asked Nov 27 '15 16:11

mandysimon88


1 Answers

The problem is that you're trying to delete the local storage data before you're actually navigating to a URL.

Your browser page actually looks like in the screenshot here.

like image 115
Cosmin Avatar answered Sep 28 '22 03:09

Cosmin