次のような画像があると想像してください。
the_image = @browser.image(:id, 'image01')
そのクラスの値を取得する方法は次のとおりです。
image_status = the_image.attribute_value('class')
Ok。私は page_object gem を使用しており、次のように画像を要素として持っているとします。
image(:the_image, :id => 'image01')
attribute_value を取得するには、次を使用できます。
image_status = the_image_element.attribute_value('class')
...しかし、非推奨の警告が表示されます:
*** DEPRECATION WARNING
*** You are calling a method named attribute_value at page.rb:68:in `get_status'.
*** This method does not exist in page-object so it is being passed to the driver.
*** This feature will be removed in the near future.
class
page_object 要素を使用して値を取得するにはどうすればよいですか? 確かに答えは簡単ですが、私はそれを見つけられませんでした。道を教えてください。
前もって感謝します!