I have installed watir-webdriver in my rails application, I want to show the preview of the site instantly, I want to show watir click events on the same page not in new window/tab, here I want to show the live preview inside iframe on the index page, I tried following:
app/models/preview.rb
def self.live_preview
browser = Watir::Browser.new :firefox, profile: 'MR'
browser.goto "http://example.com"
browser.text_field(id: 'email').set('test@gmail.com')
browser.text_field(id: 'password').set('password')
browser.button(name: 'commit').click
browser.button(name: 'learn_more').click
end
app/views/watir.rb
<%= Preview.live_preview %>
app/views/index.html.erb
<iframe id="preview" src="/watir"></iframe>
When the index page gets loaded it opens the new tab then all the events are executed but I want with in the same page
I want similar to watir-classic mentioned here to run in firefox on ubuntu