appfolio / ae_page_objects

Page Objects for Capybara
MIT License
28 stars 9 forks source link

browser.find_document should ignore Selenium::WebDriver::Error::NoSuchWindowError #64

Closed dtognazzini closed 10 years ago

dtognazzini commented 10 years ago

AePageObejcts::MultipleWindows::Browser keeps an in-memory registry of open windows. Windows are added to the registry when they are discovered via iterating over all the windows when finding documents. Windows are removed from the registry when they are explicitly closed by the test code via AePageObjects::MultipleWindows::Window#close.

Sometimes windows are closed by JS running on the page under test. If this happens, the corresponding AePageObjects::MultipleWindows::Window in memory is not removed from the registry.

If browser.find_document is called after this happens, AePageObjects will attempt to access the underlying window for the window entry in the in-memory registry and Selenium::WebDriver::Error::NoSuchWindowError will be raised.

browser.find_document should handle this error by removing the window from the in-memory registry and moving on with finding the document across the opened windows.

dtognazzini commented 10 years ago

Released in 1.2.0