Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

watir-nokogiri

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

watir-nokogiri

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Watir-Nokogiri

Watir-Nokogiri is an HTML parser using Watir's API.

Background

Watir (classic and webdriver) can have performance issues when parsing large HTML pages. One solution has been to extract the page's HTML using Watir and then parse the HTML with an HTML parser (ex Nokogiri). This required learning two APIs - Watir and the HTML parser. Watir-Nokogiri eliminates the need to learn an HTML parser API by applying the Watir API to the HTML parser Nokogiri.

Installation

gem install 'watir-nokogiri'

Usage

To use Watir-Nokogiri:

require 'watir-nokogiri'

Watir-Nokogiri can parse a string containing HTML.

This is typically supplied by a Watir browser:

doc = WatirNokogiri::Document.new(browser.html)

However, you can also read from a file:

doc = WatirNokogiri::Document.start('C:\some_file.html')

With the parsed document, you can use the standard Watir API to locate elements and validate text/attributes.

Check if an element exists

doc.div(:id => 'my_id').exists?

Get the text of an element

doc.span(:id => 'my_span').text

Get an attribute value of an element

doc.span(:id => 'my_span').attribute_value('name')

Count the number of elements

doc.text_fields.length

FAQs

Package last updated on 21 Aug 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc