lib/testcentricity_web/web_elements/ui_elements_helper.rb
# Highlight an object with a 3 pixel wide, red dashed border for the specified wait time.
# If wait time is zero, then the highlight will remain until the page is refreshed
#
# @param duration [Integer or Float] wait time in seconds
# @example
#   error_message.highlight(3)
#
Highlight an object with a 3 pixel wide, red dashed border for the specified wait time.
If wait time is zero, then the highlight will remain until the page is refreshed
Highlight an object with a 3 pixel wide red dashed border for the specified wait time . If wait time is zero then the highlight will remain until the page is refreshed
def highlight(duration = 1)
      obj, type = find_element
      object_not_found_exception(obj, type)
      @original_style = obj.native.attribute('style')
      page.execute_script(
        'arguments[0].setAttribute(arguments[1], arguments[2])',
        obj,
        'style',
        'border: 3px solid red; border-style: dashed;'
      )
      if duration.positive?
        sleep duration
        page.execute_script(
          'arguments[0].setAttribute(arguments[1], arguments[2])',
          obj,
          'style',
          @original_style
        )
      end
    end
def highlight ( duration = 1 ) obj , type = find_element object_not_found_exception ( obj , type ) @original_style = obj . native . attribute ( 'style' ) page . execute_script ( 'arguments[0].setAttribute(arguments[1], arguments[2])' , obj , 'style' , 'border: 3px solid red; border-style: dashed;' ) if duration . positive? sleep duration page . execute_script ( 'arguments[0].setAttribute(arguments[1], arguments[2])' , obj , 'style' , @original_style ) end end
Highlight an object with a 3 pixel wide, red dashed border for the specified wait time.
Highlight an object with a 3 pixel wide red dashed border for the specified wait time .
# store original style so it can be reset later # style element with red border # keep element highlighted for duration and then revert to original style
duration
wait time in seconds
wait time in seconds
example
None