Skip to content

Methods for HTML Tags

bootstraponline edited this page Apr 24, 2015 · 2 revisions
Method HTML Tags
text_field <input type="text">, <input type="password">
check_box <input type="checkbox">
button button, <input type="button">, <input type="image">, <input type="reset">, <input type="submit">
radio_button <input type="radio">
hidden_field <input type="hidden">
file_field <input type="file">
area area
canvas canvas
audio audio
video video
link a
select_list select
div div
table table
table_cell td, th
table_row tr
span span
image img
form form
text_area textarea
list_item li
unordered_list ul
ordered_list ol
option option
heading h1, h2, h3, h4, h5, h6
paragraph p
label label
bold b
# Table generated with this code then manually edited (mostly input tags)
require 'page-object'
type_map = PageObject::Elements.type_to_class
tag_map  = PageObject::Elements.tag_to_class
html_key_map = type_map.merge(tag_map)

klass_key_map = Hash.new []

html_key_map.each do |element, klass|
  klass_key_map[klass] += [element]
end

puts 'Method | HTML Tags'
puts ' ---  | ---'
klass_key_map.each do |klass, element_array|
  klass = klass.to_s.split('::').last.gsub(/([a-z])([A-Z])/, '\1_\2').downcase
  puts "**#{klass}** | #{element_array.join(', ')}"
end