Class: Watir::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/awetestlib/regression/awetest_dsl.rb

Instance Method Summary collapse

Instance Method Details

#attribute_valuesObject



4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
# File 'lib/awetestlib/regression/awetest_dsl.rb', line 4141

def attribute_values
  hash = Hash.new
  ['id', 'offsetParent', 'style', 'currentstyle',
   'offsetHeight', 'offsetWidth', 'offsetLeft', 'offsetTop',
   'clientHeight', 'clientWidth', 'clientLeft', 'clientTop',
   'scrollHeight', 'scrollWidth', 'scrollLeft', 'scrollTop',
   'className', 'resizable',
   'visible', 'sourceIndex'].each do |attr|
    hash[attr] = attribute_value(attr)
  end
  hash
end

#bottom_edgeObject



4165
4166
4167
# File 'lib/awetestlib/regression/awetest_dsl.rb', line 4165

def bottom_edge
  bounding_client_rectangle['bottom']
end

#bounding_client_rectangleObject



4159
4160
4161
4162
# File 'lib/awetestlib/regression/awetest_dsl.rb', line 4159

def bounding_client_rectangle
  assert_exists
  self.browser.execute_script("return arguments[0].getBoundingClientRect()", self)
end

#client_offsetObject



4185
4186
4187
4188
# File 'lib/awetestlib/regression/awetest_dsl.rb', line 4185

def client_offset
  hash = bounding_client_rectangle
  [hash['left'], hash['top']]
end

#dimensionsObject



4154
4155
4156
4157
# File 'lib/awetestlib/regression/awetest_dsl.rb', line 4154

def dimensions
  hash = bounding_client_rectangle
  [hash['width'], hash['height']]
end

#left_edgeObject



4175
4176
4177
# File 'lib/awetestlib/regression/awetest_dsl.rb', line 4175

def left_edge
  bounding_client_rectangle['left']
end

#list_attributesObject



4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
# File 'lib/awetestlib/regression/awetest_dsl.rb', line 4119

def list_attributes
  # binding.pry
  # attributes = browser.execute_script(%Q[
  #           var s = {};
  #           var attrs = arguments[0].attributes;
  #           for (var l = 0; l < attrs.length; ++l) {
  #               var a = attrs[l]; s[a.name] = a.value);
  #           } ;
  #           return s;],
  #                                     self
  # )
  attributes = browser.execute_script(%Q[
            var s = [];
            var attrs = arguments[0].attributes;
            for (var l = 0; l < attrs.length; ++l) {
                var a = attrs[l]; s.push(a.name + ': ' + a.value);
            } ;
            return s;],
                                      self
  )
end

#right_edgeObject



4180
4181
4182
# File 'lib/awetestlib/regression/awetest_dsl.rb', line 4180

def right_edge
  bounding_client_rectangle['right']
end

#top_edgeObject



4170
4171
4172
# File 'lib/awetestlib/regression/awetest_dsl.rb', line 4170

def top_edge
  bounding_client_rectangle['top']
end