lib/capybara/node/simple.rb
##
#
# Whether or not the element is visible. Does not support CSS, so
# the result may be inaccurate.
#
# @param  [Boolean] check_ancestors  Whether to inherit visibility from ancestors
# @return [Boolean]     Whether the element is visible
#
Whether or not the element is visible. Does not support CSS, so
the result may be inaccurate.
Whether or not the element is visible . Does not support CSS so the result may be inaccurate .
def visible?(check_ancestors = true)
        return false if (tag_name == 'input') && (native[:type] == 'hidden')
        if check_ancestors
          !find_xpath(VISIBILITY_XPATH)
        else
          !(native.key?('hidden') || (native[:style] =~ /display:\s?none/) || %w[script head].include?(tag_name))
        end
      end
def visible? ( check_ancestors = true ) return false if ( tag_name == 'input' ) && ( native [ :type ] == 'hidden' ) if check_ancestors ! find_xpath ( VISIBILITY_XPATH ) else ! ( native . key? ( 'hidden' ) || ( native [ :style ] =~ / display: \s ?none / ) || %w[ script head ] . include? ( tag_name ) ) end end
Whether or not the element is visible.
Whether or not the element is visible .
# No need for an xpath if only checking the current element
Whether the element is visible
Whether the element is visible
Boolean
check_ancestors
<not_specific>
<not_specific>
check_ancestors Whether to inherit visibility from ancestors
check_ancestors Whether to inherit visibility from ancestors