Skip to content

Commit 0f0fbe0

Browse files
committed
add spec: 'waits for selector within frame'
1 parent 8d98b79 commit 0f0fbe0

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

spec/browser_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,25 @@ module Ferrum
560560
).not_to be_nil
561561
end
562562
end
563+
564+
it "waits for selector within frame" do
565+
browser.execute <<-JS
566+
setTimeout(function(){
567+
document.body.innerHTML += "<iframe src='about:blank' name='frame'>";
568+
var iframeDocument = document.querySelector("iframe[name='frame']").contentWindow.document;
569+
var content = "<html><body><div id='wait_for_selector_within_frame'></div></body></html>";
570+
iframeDocument.open("text/html", "replace");
571+
iframeDocument.write(content);
572+
iframeDocument.close();
573+
}, 900);
574+
JS
575+
frame = browser.wait_for_selector(xpath: "//iframe[@name='frame']").at_xpath("//iframe[@name='frame']").frame
576+
expect(
577+
frame
578+
.wait_for_selector(xpath: "//div[@id='wait_for_selector_within_frame']")
579+
.at_css("div#wait_for_selector_within_frame")
580+
).not_to be_nil
581+
end
563582
end
564583

565584
context "current_url" do

0 commit comments

Comments
 (0)