Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add spec: 'waits for selector within frame'
  • Loading branch information
Mifrill committed Jan 15, 2022
commit 0f0fbe0a2dcf8bef9ad2f541d6b21a3f168e5ea3
19 changes: 19 additions & 0 deletions spec/browser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,25 @@ module Ferrum
).not_to be_nil
end
end

it "waits for selector within frame" do
browser.execute <<-JS
setTimeout(function(){
document.body.innerHTML += "<iframe src='about:blank' name='frame'>";
var iframeDocument = document.querySelector("iframe[name='frame']").contentWindow.document;
var content = "<html><body><div id='wait_for_selector_within_frame'></div></body></html>";
iframeDocument.open("text/html", "replace");
iframeDocument.write(content);
iframeDocument.close();
}, 900);
JS
frame = browser.wait_for_selector(xpath: "//iframe[@name='frame']").at_xpath("//iframe[@name='frame']").frame
expect(
frame
.wait_for_selector(xpath: "//div[@id='wait_for_selector_within_frame']")
.at_css("div#wait_for_selector_within_frame")
).not_to be_nil
end
end

context "current_url" do
Expand Down