diff --git a/lib/capybara/session.rb b/lib/capybara/session.rb index 482b0d2c..92d7039e 100644 --- a/lib/capybara/session.rb +++ b/lib/capybara/session.rb @@ -199,7 +199,7 @@ module Capybara end def sanitized_xpath_string(string) - if string =~ /'/ + if string.include?("'") string = string.split("'", -1).map do |substr| "'#{substr}'" end.join(%q{,"'",})