Scraping with Nokogiri help

Hello Im trying to scrape some info from the following page
https://www.cloudflarestatus.com/.

[Screenshot attached]

Im interested in scraping the “Operational” field on the page for
example in Africa.
So far i have the following code below but it doesn’t return anything.

Im using Xpath Helper Chrome add on to generate the Xpath code.
Any help would be appreciated.

require ‘nokogiri’
require ‘open-uri’

html_data = open(‘https://www.cloudflarestatus.com/’).read
nokogiri_object = Nokogiri::HTML(html_data)

variable = “/html/body[@class=‘status index
status-none’]/div[@class=‘layout-content status status-index
starter’]/div[@class=‘container’]/div[@class=‘components-section
font-regular’]/div[@class=‘components-container
one-column’]/div[@class=‘component-container border-color
is-group’]/div[@class='component-inner-container status-green
']/span[@class=‘component-status’]”

tagcloud_elements = nokogiri_object.xpath(variable)

#do loop
tagcloud_elements.each do |tagcloud_element|
puts tagcloud_element.text
end

Hi Ken, what happens when you print tagcloud_elements? It sounds like
it’s empty, which means, either the query string you’re using (which is
a doozie) or your nokogiri_object is no good.

If this is your first go at using nokogiri, you probably want to start
off on a simpler example.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs