Wednesday, October 27, 2010

New Browser Windows

ie1 = Watir::IE.attach(:url, 'http://mytestsite')
ie2 = Watir::IE.attach(:title, 'Test New Window')


The best benefit of Watir::IE.attach maybe, we don't need to initialize our IE window once the windows exists.
We just need locate the tab, then practice on the page.
We can locate any tab we want.

#Get the title and url of the tab existent.
Watir::IE.each do |tab|
puts tab.title
puts tab.url
end

For blank page, we may locate it use:
ie6 = Watir::IE.attach(:title, //)
ie6.goto("test site")

or
ie7=Watir::IE.attach(:url,/about:blank/)
ie7.goto("test site")

No comments:

Post a Comment