Link Elements  



It is accessed by calling either Browser#a or Browser#link. Creating an AnchorCollection is accomplished with either Browser#as or Browser#links. For all of the different ways of locating an Anchor element, take a look at our Locating Elements Guide.

They also inherit methods from standard Web Elements

Common or Special Methods

Standard Setter Interface

This functionality was added in Watir 7 beta 2.

Anchor#set is the same behavior as the superclass Element; if no arguments are passed or true is passed, it will click the link.


browser = Watir::Browser.start ''

link = /guides/)
link.href == '' # => true


Last Updated: March 28, 2021