lib/capybara/screenshot/diff/capybara_setup.rb in capybara-screenshot-diff-0.7.1 vs lib/capybara/screenshot/diff/capybara_setup.rb in capybara-screenshot-diff-0.7.2

- old
+ new

@@ -194,11 +194,13 @@ end end private def take_stable_screenshot(comparison) assert_images_loaded - execute_script('document.activeElement.blur()') if Capybara::Screenshot.blur_active_element + if Capybara::Screenshot.blur_active_element + input = page.driver.send :unwrap_script_result, execute_script('ae=document.activeElement;if (ae.nodeName == "INPUT"){ae.blur();return ae};return null') + end previous_file_size = comparison.old_file_size screeenshot_started_at = last_image_change_at = Time.now loop do save_screenshot(comparison.new_file_name) @@ -221,9 +223,11 @@ "Could not get stable screenshot within #{Capybara.default_max_wait_time}s" previous_file_size = comparison.new_file_size comparison.reset end + ensure + input.click if input end private def reduce_retina_image_size(file_name) return if !self.class.macos? || !selenium? || !Capybara::Screenshot.window_size saved_image = ChunkyPNG::Image.from_file(file_name)