Skip to content

Instantly share code, notes, and snippets.

@andreastt
Created March 24, 2011 11:10
Show Gist options
  • Save andreastt/884900 to your computer and use it in GitHub Desktop.
Save andreastt/884900 to your computer and use it in GitHub Desktop.
require 'operawatir/helper'
describe 'Frames in Watir 3' do
it 'as a block' do
window.frame(:id => 'foo') do |frame|
frame.p(:id => 'bar').should include 'bar'
end
end
it 'as an object' do
frame = window.frame(:id => 'foo')
frame.p(:id => 'bar').should include 'bar'
end
it 'programmatically' do
window.frame(:id => 'foo').p(:id => 'bar').should include 'bar'
end
it 'listing frames' do
puts window.frame.to_s
end
it 'iterating over frames' do
window.frame.each_with_index do |name, index|
puts "frame index: #{i}, frame name: #{name}"
end
end
end
describe 'Frame in Watir 2' do
it 'switching focus' do
browser.frame(:id, 'foo')
browser.p(:id, 'bar').should include 'bar'
browser.switch_to_default
end
it 'listing frames' do
browser.show_frames
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment