I’m writing a sample test with Watir where I navigate around a site with the IE class, issue queries, etc.. That works perfectly.
I want to continue by using PageContainer‘s methods on the last page I landed on. For instance, using its HTML method on that page.
Now I’m new to Ruby and just started learning it for Watir.
I tried asking this question on OpenQA, but for some reason the Watir section is restricted to normal members.
Thanks for looking at my question.
edit: here is a simple example
require 'rubygems' require 'watir' test_site = 'http://wiki.openqa.org/' browser = Watir::IE.new browser.goto(test_site) # now if I want to get the HTML source of this page, I can't use the IE class # because it doesn't have a method which supports that # the PageContainer class, does have a method that supports that # I'll continue what I want to do in pseudo code Store HTML source in text file # I know how to write to a file, so that's not a problem; # retrieving the HTML is the problem. # more specifically, using another Watir class is the problem. Close browser # end
Currently, the best place to get answers to your Watir questions is the Watir-General email list.
For this question, it would be nice to see more code. Is the application under test (AUT) opening a new window/tab that you were having trouble getting to and therefore wanted to try the PageContainer, or is it just navigating to a second page?
If it is the first one, you want to look at #attach, if it is the second, then I would recommend reading the quick start tutorial.
Edit after code added above:
What I think you missed is that Watir::IE includes the Watir::PageContainer module. So you can call
browser.htmlto get the html displayed on the page to which you’ve navigated.