Ruby 如何在watir中为下拉框属性检查文本颜色

Ruby 如何在watir中为下拉框属性检查文本颜色,ruby,automation,watir,Ruby,Automation,Watir,它将错误显示为 contents = $ie.select_list(:id, "dropdown").getAllContents puts contents.currentstyle.color 当我需要获取特定颜色的特定记录时,有人能帮我吗假定您有如下HTML: 1) Error: test_01(TC_Login): NoMethodError: undefined method `currentstyle' for 如果要获取具有匹配颜色的Watir::Option对象,可以执行以

它将错误显示为

contents = $ie.select_list(:id, "dropdown").getAllContents
puts contents.currentstyle.color

当我需要获取特定颜色的特定记录时,有人能帮我吗假定您有如下HTML:

1) Error:
test_01(TC_Login):
NoMethodError: undefined method `currentstyle' for
如果要获取具有匹配颜色的Watir::Option对象,可以执行以下操作:

puts $ie.select_list(:id, "dropdown").document.options(0).style.color

假设您有如下HTML:

1) Error:
test_01(TC_Login):
NoMethodError: undefined method `currentstyle' for
如果要获取具有匹配颜色的Watir::Option对象,可以执行以下操作:

puts $ie.select_list(:id, "dropdown").document.options(0).style.color

最好看看html和css。可能不是为下拉列表内容设置样式,而是为下拉列表本身设置样式。不管怎么说,这是一些帮助你的信息,最好看看html和css。可能不是为下拉列表内容设置样式,而是为下拉列表本身设置样式。不管怎么说,这是人们帮助你很好的信息灯。