Sha256: 2e46e0dd07070e972d87d831dbee6106a8d773e1427be24053fa6a8cce135293
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
require File.expand_path('watirspec/spec_helper', File.dirname(__FILE__)) describe 'Watir' do describe '#always_locate?' do before do browser.goto WatirSpec.url_for('removed_element.html', :needs_server => true) end it 'determines whether #exist? returns false for stale element' do element = browser.div(:id => "text") expect(element.exists?).to be true browser.refresh expect(element.exists?).to be Watir.always_locate? end it 'allows using cached elements regardless of setting, when element is not stale' do element = browser.div(:id => "text") expect(element.exists?).to be true # exception raised if element is re-looked up allow(browser.driver).to receive(:find_element).with(:id, 'text') { raise } expect { element.exists? }.to_not raise_error end it 'determines whether an exception is raised when taking an action on a stale element' do element = browser.div(:id => "text") expect(element.exists?).to be true browser.refresh if Watir.always_locate? expect { element.text }.to_not raise_error else expect { element.text }.to raise_error end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
watir-webdriver-0.7.0 | spec/always_locate_spec.rb |