1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Fix workaround for safari disabled node issues

This commit is contained in:
Thomas Walpole 2019-04-18 14:20:23 -07:00
parent 533c6eb3c4
commit 6126b358c4

View file

@ -40,10 +40,12 @@ class Capybara::Selenium::SafariNode < Capybara::Selenium::Node
end end
def disabled? def disabled?
return true if super || (self[:disabled] == 'true') return true if super
# workaround for safaridriver reporting elements as enabled when they are nested in disabling elements # workaround for safaridriver reporting elements as enabled when they are nested in disabling elements
if %w[option optgroup].include? tag_name if %w[option optgroup].include? tag_name
return true if self[:disabled] == 'true'
find_xpath('parent::*[self::optgroup or self::select]')[0].disabled? find_xpath('parent::*[self::optgroup or self::select]')[0].disabled?
else else
!find_xpath(DISABLED_BY_FIELDSET_XPATH).empty? !find_xpath(DISABLED_BY_FIELDSET_XPATH).empty?