-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WARN: Screenshot could not be saved. page.current_path is empty #277
Comments
"WARN: Screenshot could not be saved. page.current_path is empty" is an indication that the browser has yet to load a page. Are you sure the page has loaded? |
I was also getting this warning. I noticed that the screenshots are actually getting saved despite what the error says. To work around this I have added the following monkey patch. Capybara::Screenshot::Saver.class_eval do
def save
current_path do |path|
if path.empty?
next ### CUSTOM
#warn 'WARN: Screenshot could not be saved. `page.current_path` is empty.'
else
begin
save_html if @html_save
rescue StandardError => e
warn "WARN: HTML source could not be saved. An exception is raised: #{e.inspect}."
end
begin
save_screenshot
rescue StandardError => e
warn "WARN: Screenshot could not be saved. An exception is raised: #{e.inspect}."
end
end
end
end
end I think that likely an official fix is due here. |
This is a continuation of this thread: #243 |
It looks like this warning occurs due to multiple problems. In my case, it is not saving the screenshots as @westonganger suggests above, so that fix doesn't help me. GalenkoEugene's comment helped me discover that my problem was caused by Capybara.reset_sessions! in an rspec I found in my case # Delete cookies after all responses have completed
config.after(:each, js: true) do
RackRequestBlocker.wait_for_requests_complete
# Capybara.reset_sessions! # <- that was too extreme, let's try a gentler method:
Capybara.current_session.driver.browser.manage.delete_all_cookies # Delete cookies with Selenium
end So it seems this is often due to conflicting configuration. I don't know enough to be able to suggest how it could be generally resolved. |
I'm running the test using
bundle exec rspec
, which gives me the error of:WARN: Screenshot could not be saved. page.current_path is empty
.also getting this error:
Failure/Error: expect(page).to have_selector(".name", text: "Take Notes")
.Here's the test I'm trying to test:
/spec/system/add_task_spec.rb
The text was updated successfully, but these errors were encountered: