Imagine i have a image like:
the_image = @browser.image(:id, 'image01')
The way to get the value of its class could be:
image_status = the_image.attribute_value('class')
Ok. I'm using page_object gem and lets suppose i have the image as element, like:
image(:the_image, :id => 'image01')
To get the attribute_value i can use:
image_status = the_image_element.attribute_value('class')
...but i get a DEPRECATION WARNING:
*** 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.
How can i get the class
value using the page_object element? Sure the answer is easy but i didn't found it. Can you please tell me the way?
Thank you in advance!
If you are using the latest versions of Page-Object and Watir (v2.2.1 and v6.7.3 respectively), the attribute_value
will no longer give a deprecation warning. Both #attribute
and #attribute_value
are supported.
For older version of Page-Object, you need to use the #attribute
method:
image_status = the_image_element.attribute('class')