Module: Locator
- Extended by:
- Locator
- Included in:
- Locator
- Defined in:
- lib/locator.rb,
lib/locator/dom.rb,
lib/locator/xpath.rb,
lib/locator/result.rb,
lib/locator/boolean.rb,
lib/locator/element.rb,
lib/locator/matcher.rb,
lib/locator/version.rb,
lib/locator/dom/htmlunit.rb,
lib/locator/dom/nokogiri.rb,
lib/locator/element/area.rb,
lib/locator/element/file.rb,
lib/locator/element/form.rb,
lib/locator/element/link.rb,
lib/locator/element/field.rb,
lib/locator/element/input.rb,
lib/locator/element/label.rb,
lib/locator/element/button.rb,
lib/locator/element/select.rb,
lib/locator/element/content.rb,
lib/locator/matcher/have_tag.rb,
lib/locator/dom/htmlunit/page.rb,
lib/locator/dom/nokogiri/page.rb,
lib/locator/element/check_box.rb,
lib/locator/element/text_area.rb,
lib/locator/dom/htmlunit/element.rb,
lib/locator/dom/nokogiri/element.rb,
lib/locator/element/form_element.rb,
lib/locator/element/hidden_field.rb,
lib/locator/element/radio_button.rb,
lib/locator/element/elements_list.rb,
lib/locator/element/select_option.rb,
lib/locator/element/labeled_element.rb
Defined Under Namespace
Modules: Boolean, Dom, Matcher
Classes: Element, ElementNotFound, Result, Xpath
Constant Summary
collapse
- VERSION =
"0.0.5"
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.[](type) ⇒ Object
18
19
20
|
# File 'lib/locator.rb', line 18
def [](type)
locators[type.to_sym] || raise("unknown locator type: #{type}")
end
|
.build(type) ⇒ Object
22
23
24
25
|
# File 'lib/locator.rb', line 22
def build(type)
locator = locators[type.to_sym] if type
locator ? locator.new : Locator::Element.new(type)
end
|
Instance Method Details
#all(dom, *args) ⇒ Object
45
46
47
|
# File 'lib/locator.rb', line 45
def all(dom, *args)
lookup(:all, dom, *args)
end
|
#locate(dom, *args, &block) ⇒ Object
49
50
51
|
# File 'lib/locator.rb', line 49
def locate(dom, *args, &block)
lookup(:locate, dom, *args, &block)
end
|
#scopes ⇒ Object
36
37
38
|
# File 'lib/locator.rb', line 36
def scopes
@scopes ||= []
end
|
#within(*args) {|scopes.last| ... } ⇒ Object
53
54
55
56
57
|
# File 'lib/locator.rb', line 53
def within(*args)
dom = dom?(args.first) ? args.shift : scopes.pop
scopes << resolve_scope(dom, args)
yield(scopes.last)
end
|
#xpath(*args) ⇒ Object
40
41
42
43
|
# File 'lib/locator.rb', line 40
def xpath(*args)
type = args.shift if args.first.is_a?(Symbol)
Locator[type].new.xpath(*args)
end
|