Where is this text coming from with poltergeist?

51 views Asked by At

I'm scraping my library's website with Poltergeist, in my first experience with that gem (or with Capybara, for that matter). It's working great. Super great.

def self.scrape_book_list(url)
    session = Capybara::Session.new(:poltergeist)
    session.visit(url)
    books = session.all('.js-titleCard')
    books_hash = books.map { |book|
      # getting info from the session
    } 
    books_hash
end

However, after the session.visit(url) line, before it even does anything else, it prints this:

Hi there! This site is powered by OverDrive and our vision is a world enlightened by reading. Maybe a curious cat like you can help https://company.overdrive.com/company/careers/open-positions/

I've tried inspecting the page in Chrome, and even peeking at a few js sources, but I can't seem to figure out where this text is coming from!

I imagine the question is "Why/how is poltergeist doing this?" and I figured that searching the html or js code would turn the text up in some tag from the header that poltergeist perhaps always prints when it visits a page or something (maybe there's a different method to pass the url to besides visit that won't do this). But no luck!

I'm so curious (like the cat they mention)! Any ideas?

1

There are 1 answers

2
Thomas Walpole On

That text will be coming from a console.log(...) statement somewhere in the sites JS. By default Poltergeist outputs all JS console logs to stdout.