Search code examples
screen-scrapingcelerity

Is there a way to identify bolded (<b></b>) with Celerity


I'm using celerity to do some screen scraping and have come across the need to identify text elements that are in bold. Celerity offers a strong method but does not offer a bold method. Has anyone figured out a clever way around this with Celerity or other tool. I tried using:

browser.html.gsub!(<b>,<strong>)
browser.html.gsub!(</b>,</strong>)

I though I could replace the bold elements with strong elements and then simply use celerity's strong method, but this didn't seem to work.

Thanks in advance for your help.


Solution

  • It seems strange that b is missing but you can try:

    browser.elements_by_xpath('//b').each do |b|
        puts "#{b} is a bold tag"
    end