Module: OmniAI::Tools::Browser::SelectorGenerator::BaseSelectors

Included in:
OmniAI::Tools::Browser::SelectorGenerator
Defined in:
lib/omniai/tools/browser/selector_generator/base_selectors.rb

Overview

Basic selector generation methods

Instance Method Summary collapse

Instance Method Details

#aria_label_selector(element, tag) ⇒ Object



13
14
15
# File 'lib/omniai/tools/browser/selector_generator/base_selectors.rb', line 13

def aria_label_selector(element, tag)
  valid_attribute?(element["aria-label"]) ? ["#{tag}[aria-label=\"#{element['aria-label']}\"]"] : []
end

#maxlength_selector(element, tag) ⇒ Object



21
22
23
# File 'lib/omniai/tools/browser/selector_generator/base_selectors.rb', line 21

def maxlength_selector(element, tag)
  valid_attribute?(element["maxlength"]) ? ["#{tag}[maxlength=\"#{element['maxlength']}\"]"] : []
end

#name_selector(element, tag) ⇒ Object



17
18
19
# File 'lib/omniai/tools/browser/selector_generator/base_selectors.rb', line 17

def name_selector(element, tag)
  valid_attribute?(element["name"]) ? ["#{tag}[name=\"#{element['name']}\"]"] : []
end

#placeholder_selector(element, tag) ⇒ Object



9
10
11
# File 'lib/omniai/tools/browser/selector_generator/base_selectors.rb', line 9

def placeholder_selector(element, tag)
  valid_attribute?(element["placeholder"]) ? ["#{tag}[placeholder=\"#{element['placeholder']}\"]"] : []
end