Skip to content

Commit 61f3add

Browse files
authored
Merge pull request #184 from KenSrc/master
add switch iframe api
2 parents 3725458 + 2db8ed6 commit 61f3add

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

AppiumLibrary/keywords/_applicationmanagement.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,24 @@ def get_window_width(self):
321321
def switch_to_context(self, context_name):
322322
"""Switch to a new context"""
323323
self._current_application().switch_to.context(context_name)
324+
325+
def switch_to_frame(self, frame):
326+
"""
327+
Switches focus to the specified frame, by index, name, or webelement.
328+
329+
Example:
330+
| Go To Url | http://www.xxx.com |
331+
| Switch To Frame | iframe_name|
332+
| Click Element | xpath=//*[@id="online-btn"] |
333+
"""
334+
self._current_application().switch_to.frame(frame)
335+
336+
def switch_to_parent_frame(self):
337+
"""
338+
Switches focus to the parent context. If the current context is the top
339+
level browsing context, the context remains unchanged.
340+
"""
341+
self._current_application().switch_to.parent_frame()
324342

325343
def go_to_url(self, url):
326344
"""

0 commit comments

Comments
 (0)