Skip to content

Commit 273720e

Browse files
authored
Skip injecting extensions on frame switch to prevent javascript errors (#201)
1 parent 04becb9 commit 273720e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/capybara/cuprite/page.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ def switch_to_frame(handle)
123123
@frame_stack = []
124124
else
125125
@frame_stack << handle
126-
inject_extensions
127126
end
128127
end
129128

spec/features/session_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,18 @@
824824
expect(e).to be_a(Capybara::ElementNotFound)
825825
end)
826826
end
827+
828+
it "generates no javascript errors when switching into a frame" do
829+
@session.driver.browser.evaluate_on_new_document(
830+
"window.errors ||= []; window.onerror = function(msg) { window.errors += msg; };"
831+
)
832+
833+
@session.visit "/cuprite/frames"
834+
@session.within_frame(0) do
835+
expect(@session.evaluate_script("window.errors")).to be_empty
836+
end
837+
expect(@session.evaluate_script("window.errors")).to be_empty
838+
end
827839
end
828840

829841
it "handles obsolete node during an attach_file" do

0 commit comments

Comments
 (0)