Module: Watir

Defined in:
lib/watir/logger.rb,
lib/watir.rb,
lib/watir/wait.rb,
lib/watir/alert.rb,
lib/watir/window.rb,
lib/watir/aliases.rb,
lib/watir/browser.rb,
lib/watir/cookies.rb,
lib/watir/adjacent.rb,
lib/watir/locators.rb,
lib/watir/container.rb,
lib/watir/exception.rb,
lib/watir/radio_set.rb,
lib/watir/has_window.rb,
lib/watir/screenshot.rb,
lib/watir/wait/timer.rb,
lib/watir/after_hooks.rb,
lib/watir/js_snippets.rb,
lib/watir/legacy_wait.rb,
lib/watir/capabilities.rb,
lib/watir/elements/row.rb,
lib/watir/js_execution.rb,
lib/watir/elements/area.rb,
lib/watir/elements/cell.rb,
lib/watir/elements/font.rb,
lib/watir/elements/form.rb,
lib/watir/elements/link.rb,
lib/watir/elements/list.rb,
lib/watir/row_container.rb,
lib/watir/user_editable.rb,
lib/watir/xpath_support.rb,
lib/watir/cell_container.rb,
lib/watir/elements/dlist.rb,
lib/watir/elements/image.rb,
lib/watir/elements/input.rb,
lib/watir/elements/radio.rb,
lib/watir/elements/table.rb,
lib/watir/elements/button.rb,
lib/watir/elements/hidden.rb,
lib/watir/elements/iframe.rb,
lib/watir/elements/option.rb,
lib/watir/elements/select.rb,
lib/watir/attribute_helper.rb,
lib/watir/elements/element.rb,
lib/watir/elements/checkbox.rb,
lib/watir/element_collection.rb,
lib/watir/elements/table_row.rb,
lib/watir/elements/text_area.rb,
lib/watir/elements/date_field.rb,
lib/watir/elements/file_field.rb,
lib/watir/elements/table_cell.rb,
lib/watir/elements/text_field.rb,
lib/watir/extensions/nokogiri.rb,
lib/watir/generator/base/util.rb,
lib/watir/locators/row/locator.rb,
lib/watir/elements/svg_elements.rb,
lib/watir/generator/svg/visitor.rb,
lib/watir/locators/cell/locator.rb,
lib/watir/elements/html_elements.rb,
lib/watir/elements/table_section.rb,
lib/watir/generator/base/visitor.rb,
lib/watir/generator/html/visitor.rb,
lib/watir/generator/svg/generator.rb,
lib/watir/locators/button/locator.rb,
lib/watir/elements/date_time_field.rb,
lib/watir/generator/base/generator.rb,
lib/watir/generator/html/generator.rb,
lib/watir/locators/element/locator.rb,
lib/watir/generator/base/idl_sorter.rb,
lib/watir/locators/button/validator.rb,
lib/watir/locators/element/validator.rb,
lib/watir/locators/text_area/locator.rb,
lib/watir/locators/text_field/locator.rb,
lib/watir/generator/svg/spec_extractor.rb,
lib/watir/generator/base/spec_extractor.rb,
lib/watir/generator/html/spec_extractor.rb,
lib/watir/locators/row/selector_builder.rb,
lib/watir/locators/text_field/validator.rb,
lib/watir/locators/cell/selector_builder.rb,
lib/watir/locators/button/selector_builder.rb,
lib/watir/locators/element/selector_builder.rb,
lib/watir/locators/text_area/selector_builder.rb,
lib/watir/locators/text_field/selector_builder.rb,
lib/watir/locators/button/selector_builder/xpath.rb,
lib/watir/locators/element/selector_builder/xpath.rb,
lib/watir/locators/text_field/selector_builder/xpath.rb

Overview

Autogenerated from HTML specification. Edits may be lost.

Defined Under Namespace

Modules: Adjacent, AttributeHelper, CellContainer, Container, EventuallyPresent, Exception, Generator, HasWindow, JSExecution, JSSnippets, List, Locators, RowContainer, UserEditable, Wait, Waitable, XpathSupport Classes: AfterHooks, Alert, Anchor, AnchorCollection, Applet, AppletCollection, Area, AreaCollection, Audio, AudioCollection, BR, BRCollection, Base, BaseCollection, BaseDecorator, Body, BodyCollection, Browser, Button, ButtonCollection, Canvas, CanvasCollection, Capabilities, Cell, CellCollection, CheckBox, CheckBoxCollection, Circle, CircleCollection, Cookies, Cursor, CursorCollection, DList, DListCollection, Data, DataCollection, DataList, DataListCollection, DateField, DateFieldCollection, DateTimeField, DateTimeFieldCollection, Defs, DefsCollection, Desc, DescCollection, Details, DetailsCollection, Directory, DirectoryCollection, Div, DivCollection, Element, ElementCollection, Ellipse, EllipseCollection, Embed, EmbedCollection, FieldSet, FieldSetCollection, FileField, FileFieldCollection, Font, FontCollection, ForeignObject, ForeignObjectCollection, Form, FormCollection, Frame, FrameCollection, FrameSet, FrameSetCollection, FramedDriver, G, GCollection, Geometry, GeometryCollection, Gradient, GradientCollection, Graphics, GraphicsCollection, HR, HRCollection, HTMLElement, HTMLElementCollection, Hatch, HatchCollection, Hatchpath, HatchpathCollection, Head, HeadCollection, Heading, HeadingCollection, Hidden, HiddenCollection, Html, HtmlCollection, IFrame, IFrameCollection, Image, ImageCollection, Input, InputCollection, Keygen, KeygenCollection, LI, LICollection, Label, LabelCollection, Legend, LegendCollection, Line, LineCollection, LinearGradient, LinearGradientCollection, Logger, Map, MapCollection, Marker, MarkerCollection, Marquee, MarqueeCollection, Media, MediaCollection, Menu, MenuCollection, MenuItem, MenuItemCollection, Mesh, MeshCollection, MeshGradient, MeshGradientCollection, Meshpatch, MeshpatchCollection, Meshrow, MeshrowCollection, Meta, MetaCollection, Metadata, MetadataCollection, Meter, MeterCollection, Mod, ModCollection, OList, OListCollection, Object, ObjectCollection, OptGroup, OptGroupCollection, Option, OptionCollection, Output, OutputCollection, Paragraph, ParagraphCollection, Param, ParamCollection, Path, PathCollection, Pattern, PatternCollection, Picture, PictureCollection, Polygon, PolygonCollection, Polyline, PolylineCollection, Pre, PreCollection, Progress, ProgressCollection, Quote, QuoteCollection, RadialGradient, RadialGradientCollection, Radio, RadioCollection, RadioSet, Rect, RectCollection, Row, RowCollection, SVG, SVGCollection, SVGElement, SVGElementCollection, Screenshot, Script, ScriptCollection, Select, SelectCollection, Solidcolor, SolidcolorCollection, Source, SourceCollection, Span, SpanCollection, Stop, StopCollection, Style, StyleCollection, Switch, SwitchCollection, Symbol, SymbolCollection, TSpan, TSpanCollection, Table, TableCaption, TableCaptionCollection, TableCell, TableCellCollection, TableCol, TableColCollection, TableCollection, TableDataCell, TableDataCellCollection, TableHeaderCell, TableHeaderCellCollection, TableRow, TableRowCollection, TableSection, TableSectionCollection, Template, TemplateCollection, TextArea, TextAreaCollection, TextContent, TextContentCollection, TextField, TextFieldCollection, TextPath, TextPathCollection, TextPositioning, TextPositioningCollection, Time, TimeCollection, Title, TitleCollection, Track, TrackCollection, UList, UListCollection, Unknown, UnknownCollection, Use, UseCollection, Video, VideoCollection, View, ViewCollection, WhenEnabledDecorator, WhenPresentDecorator, Window

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.always_locate=(value) ⇒ Object (writeonly)

Sets the attribute always_locate

Parameters:

  • value

    the value to set the attribute always_locate to.



27
28
29
# File 'lib/watir.rb', line 27

def always_locate=(value)
  @always_locate = value
end

.default_timeoutObject

Default wait time for wait methods.



77
78
79
# File 'lib/watir.rb', line 77

def default_timeout
  @default_timeout ||= 30
end

.locator_namespaceObject

Whether the locators should be used from a different namespace. Defaults to Watir::Locators.



86
87
88
# File 'lib/watir.rb', line 86

def locator_namespace
  @locator_namespace ||= Watir::Locators
end

.prefer_css=(value) ⇒ Object (writeonly)

Sets the attribute prefer_css

Parameters:

  • value

    the value to set the attribute prefer_css to.



27
28
29
# File 'lib/watir.rb', line 27

def prefer_css=(value)
  @prefer_css = value
end

.relaxed_locate=(value) ⇒ Object (writeonly)

Sets the attribute relaxed_locate

Parameters:

  • value

    the value to set the attribute relaxed_locate to.



27
28
29
# File 'lib/watir.rb', line 27

def relaxed_locate=(value)
  @relaxed_locate = value
end

Class Method Details

.always_locate?Boolean

Whether or not Watir should re-locate a stale Element on use.

Returns:

  • (Boolean)


43
44
45
46
# File 'lib/watir.rb', line 43

def always_locate?
  always_locate_message
  true
end

.always_locate_messageObject



48
49
50
51
52
53
54
# File 'lib/watir.rb', line 48

def always_locate_message
  Watir.logger.warn <<-EOS
Watir#always_locate is deprecated; elements are always cached and will always
be re-located if they go stale before use.
Use Element#stale? or Element#wait_until(&:stale?) if needed for flow control.
  EOS
end

.element_class_for(tag_name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



102
103
104
# File 'lib/watir.rb', line 102

def element_class_for(tag_name)
  tag_to_class[tag_name.to_sym] || HTMLElement
end

.loggerLogger

Returns logger instance that can be used across the whole Selenium.

Returns:



113
114
115
# File 'lib/watir.rb', line 113

def self.logger
  @logger ||= Watir::Logger.new
end

.prefer_css?Boolean

Whether or not Watir should prefer CSS when translating the Watir selectors to Selenium.

Returns:

  • (Boolean)


60
61
62
63
# File 'lib/watir.rb', line 60

def prefer_css?
  prefer_css_message
  false
end

.prefer_css_messageObject



65
66
67
68
69
70
71
# File 'lib/watir.rb', line 65

def prefer_css_message
  Watir.logger.warn <<-EOS
Watir#prefer_css is deprecated; all elements that can not be passed directly
as Selenium locators will be translated to XPath. To continue using CSS Selectors
require the watir_css gem - https://github.com/watir/watir_css
  EOS
end

.relaxed_locate?Boolean

Whether or not Watir should wait for an element to be found or present before taking an action. Defaults to true.

Returns:

  • (Boolean)


35
36
37
# File 'lib/watir.rb', line 35

def relaxed_locate?
  @relaxed_locate
end

.tag_to_classObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



94
95
96
# File 'lib/watir.rb', line 94

def tag_to_class
  @tag_to_class ||= {}
end