I want to debug/develop code using irb:
irb> require "capybara"
irb> include Capybara::DSL
irb> Capybara.current_driver = :selenium
irb> visit "http://example.com"
But how do I get an HTML of the element I found?
irb> s = find(".user-pane")
=> #<Capybara::Element tag="nav">
irb> s.native.inner_html
NoMethodError: undefined method `inner_html' for #<Selenium::WebDriver::Element:0x007fc1da191b28>
gem list
capybara (2.4.4)
nokogiri (1.5.6)
selenium-webdriver (2.43.0)
Solutions, that I've found on SO and elsewhere don't work:
.inner_html
doesn't work anymore?.native
is now WebDriver, not Nokogiri object..native.get_attribute
doesn't work?So the answer is: s.native.attribute('outerHTML')
But it takes near 5 second to accomplish even on google.com page.
UPD: .property("outerHTML")
if Cuprite, not Selenium.