I am using Watir with Ruby on Rails.
I need to save screenshots of couple of pages using Watir. I have managed to get the page that I want to open to show in a browser, but cannot save the screenshot yet. Here's my code:
@browser = Watir::Safari.new
folios_screenshot_path = Rails.root.join('screenshots/')
@page = Page.find(5)
cur_url = root_url + 'pages/' + @page.id.to_s
@browser.goto cur_url
@browser.div(:id => "page").wait_until_present
@browser.driver.save_screenshot(pagess_screenshot_path + '/' + @page.id.to_s + '.png')
@browser.close
In the page that I load, there's a div element with id 'page', and I am trying to make Watir wait till that element is loaded in the Watir browser. But in my main browser, I get the error Unable to load page within 10 seconds, and the screenshot doesn't get saved either. Any idea on what's wrong?