Sha256: 19e92981cdb1f2616c804111dff1df106c90fcc34a5ea1080b83f1e702d46cbe

Contents?: true

Size: 742 Bytes

Versions: 26

Compression:

Stored size: 742 Bytes

Contents

require File.expand_path('../selectors/defaults', __FILE__)

def fsf(*args)
  selector        = sf(*args)
  selector_format = selector.starts_with?('.//') ? :xpath : :css

  page.find(selector_format, selector)
end

def idsf(*args)
  id_selector = sf(*args)
  id_selector.starts_with?('#') ? id_selector[1..-1] : id_selector
end

def sf(*args)
  selector_description = args[0]
  selector_entry       = RSpectacular.selectors.find { |regex, selector| selector_description.match regex }

  fail "Cannot find selector for '#{selector_description}'. Please add it to the list of selectors." if selector_entry.nil?

  selector             = selector_entry[1]

  if selector.respond_to? :call
    selector.call(*args)
  else
    selector
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
rspectacular-0.53.1 lib/rspectacular/selectors.rb
rspectacular-0.53.0 lib/rspectacular/selectors.rb
rspectacular-0.52.0 lib/rspectacular/selectors.rb
rspectacular-0.51.0 lib/rspectacular/selectors.rb
rspectacular-0.50.0 lib/rspectacular/selectors.rb
rspectacular-0.49.0 lib/rspectacular/selectors.rb
rspectacular-0.48.0 lib/rspectacular/selectors.rb
rspectacular-0.47.0 lib/rspectacular/selectors.rb
rspectacular-0.46.0 lib/rspectacular/selectors.rb
rspectacular-0.45.0 lib/rspectacular/selectors.rb
rspectacular-0.44.0 lib/rspectacular/selectors.rb
rspectacular-0.43.0 lib/rspectacular/selectors.rb
rspectacular-0.42.0 lib/rspectacular/selectors.rb
rspectacular-0.41.0 lib/rspectacular/selectors.rb
rspectacular-0.40.0 lib/rspectacular/selectors.rb
rspectacular-0.39.0 lib/rspectacular/selectors.rb
rspectacular-0.38.0 lib/rspectacular/selectors.rb
rspectacular-0.37.0 lib/rspectacular/selectors.rb
rspectacular-0.36.0 lib/rspectacular/selectors.rb
rspectacular-0.35.0 lib/rspectacular/selectors.rb