diff --git a/lib/capybara/playwright/node.rb b/lib/capybara/playwright/node.rb index 3576a06..90642eb 100644 --- a/lib/capybara/playwright/node.rb +++ b/lib/capybara/playwright/node.rb @@ -131,7 +131,7 @@ def visible_text } } JAVASCRIPT - text.to_s.gsub(/\A[[:space:]&&[^\u00a0]]+/, '') + text.to_s.scrub.gsub(/\A[[:space:]&&[^\u00a0]]+/, '') .gsub(/[[:space:]&&[^\u00a0]]+\z/, '') .gsub(/\n+/, "\n") .tr("\u00a0", ' ')