Reputation: 631
Imagine i have a div like (in Watir language):
@browser.div(:id, 'home_slideshow')
I need the html code inside to do some "magic regex" :). The way to get the div html code could be:
the_div_html = @browser.div(:id, 'home_slideshow').html
Ok. I'm using page_object gem and lets suppose i have the div as element, like:
div(:slide_show, :id => 'home_slideshow')
To get the html inside i can use:
the_div_html = slide_show_element.html
...but i get the DEPRECATION WARNING:
*** DEPRECATION WARNING
*** You are calling a method named attribute_value at home_page.rb:80:in `get_slide_code'.
*** 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 html code using the page_object element? As some similar questions i made before, sure the answer is so easy, but i look into the Cheezy book, the whole stackoverflow and the page-object rubydoc info and i didn't found it. Can you please tell me the way?
Thank you in advance!
Upvotes: 3
Views: 860
Reputation: 46846
As a temporary workaround, you could access the watir-webdriver element directly using .element
.
The following would give you the html without the depreciation warning:
slide_show_element.element.html
Upvotes: 4
Reputation: 57322
slide_show_element.html
should return element HTML. Does it?
Deprecation warning just means page-object api does not support #html
method yet. You should request it here: https://github.com/cheezy/page-object/issues?state=open
Upvotes: 5