Class Mechanize::Page::Link
In: lib/mechanize/page/link.rb
Parent: Object

This class encapsulates links. It contains the text and the URI for ‘a’ tags parsed out of an HTML page. If the link contains an image, the alt text will be used for that image.

For example, the text for the following links with both be ‘Hello World’:

  <a href="http://example">Hello World</a>
  <a href="http://example"><img src="test.jpg" alt="Hello World"></a>

Methods

click   dom_class   dom_id   new   noreferrer?   rel   rel?   text   to_s   uri  

External Aliases

page -> referer
pretty_inspect -> inspect

Attributes

attributes  [R] 
href  [R] 
node  [R] 
page  [R] 

Public Class methods

Public Instance methods

Click on this link

This method is a shorthand to get a link‘s DOM class Common usage:

  page.link_with(:dom_class => "links_exact_class")

This method is a shorthand to get link‘s DOM id. Common usage:

  page.link_with(:dom_id => "links_exact_id")

Test if this link should not be traced.

A list of words in the rel attribute, all lower-cased.

Test if the rel attribute includes kind.

The text content of this link

to_s()

Alias for text

A URI for the href for this link. The link is first parsed as a raw link. If that fails parsing an escaped link is attepmted.

[Validate]