diff --git a/lib/capybara/poltergeist/client/compiled/web_page.js b/lib/capybara/poltergeist/client/compiled/web_page.js index 30743032..4640818c 100644 --- a/lib/capybara/poltergeist/client/compiled/web_page.js +++ b/lib/capybara/poltergeist/client/compiled/web_page.js @@ -232,11 +232,7 @@ Poltergeist.WebPage = (function() { WebPage.prototype.popFrame = function() { this.frames.pop(); - if (this.frames.length === 0) { - return this["native"].switchToMainFrame(); - } else { - return this["native"].switchToFrame(this.frames[this.frames.length - 1]); - } + return this["native"].switchToParentFrame(); }; WebPage.prototype.getPage = function(name) { diff --git a/lib/capybara/poltergeist/client/web_page.coffee b/lib/capybara/poltergeist/client/web_page.coffee index 3957c793..cc21ebb5 100644 --- a/lib/capybara/poltergeist/client/web_page.coffee +++ b/lib/capybara/poltergeist/client/web_page.coffee @@ -158,11 +158,7 @@ class Poltergeist.WebPage popFrame: -> @frames.pop() - - if @frames.length == 0 - @native.switchToMainFrame() - else - @native.switchToFrame(@frames[@frames.length - 1]) + @native.switchToParentFrame() getPage: (name) -> if @sub_pages[name]