Skip to content

Commit ea0c138

Browse files
committed
Add method: "self.set_content_to_frame()"
1 parent 7dd40f0 commit ea0c138

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

help_docs/method_summary.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ self.switch_to_frame(frame, timeout=None)
197197

198198
self.switch_to_default_content()
199199

200+
self.set_content_to_frame(frame, timeout=None)
201+
200202
self.open_new_window(switch_to=True)
201203

202204
self.switch_to_window(window, timeout=None)

seleniumbase/fixtures/base_case.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,6 +2248,13 @@ def switch_to_default_content(self):
22482248
self.__check_scope()
22492249
self.driver.switch_to.default_content()
22502250

2251+
def set_content_to_frame(self, frame, timeout=None):
2252+
"""Replaces the page html with an iframe's html from that page."""
2253+
self.switch_to_frame(frame, timeout=timeout)
2254+
iframe_html = self.get_page_source()
2255+
self.switch_to_default_content()
2256+
self.set_content(iframe_html)
2257+
22512258
def open_new_window(self, switch_to=True):
22522259
""" Opens a new browser tab/window and switches to it by default. """
22532260
self.__check_scope()

0 commit comments

Comments
 (0)