Yeah ideally you find the thing that might have a comma, then get its text, then use your language to see if it has a comma:
sample_text = driver.find_element(id: 'maybe_comma').text
puts sample_text.include?(',') ? "Failed" : "Passed"
If you actually want to locate an element based on text, then I'm going to point you to Watir, which uses the Ruby Selenium library, but provides a number of extra locator strategies so you don't have to deal with XPath.
puts browser.divs(text: /,/).any? ? "Failed" : "Passed"