Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Release Notes
=============

1.1 (unreleased)
----------------
- Added iframe support by removing strict filtering for only <frame> elements.
[emanlove]

1.0.1
-----
- Support for Robot Framework 2.7
Expand Down
2 changes: 1 addition & 1 deletion src/Selenium2Library/keywords/_browsermanagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def select_frame(self, locator):
details about locating elements.
"""
self._info("Selecting frame '%s'." % locator)
element = self._element_find(locator, True, True, tag='frame')
element = self._element_find(locator, True, True)
self._current_browser().switch_to_frame(element)

def select_window(self, locator=None):
Expand Down
4 changes: 2 additions & 2 deletions src/Selenium2Library/keywords/_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def _element_find(self, locator, first_only, required, tag=None):

def _frame_contains(self, locator, text):
browser = self._current_browser()
element = self._element_find(locator, True, True, 'frame')
element = self._element_find(locator, True, True)
browser.switch_to_frame(element)
self._info("Searching for text from frame '%s'." % locator)
found = self._is_text_present(text)
Expand Down Expand Up @@ -589,7 +589,7 @@ def _page_contains(self, text):
if self._is_text_present(text):
return True

subframes = self._element_find("tag=frame", False, False, 'frame')
subframes = self._element_find("xpath=//frame|//iframe", False, False)
self._debug('Current frame has %d subframes' % len(subframes))
for frame in subframes:
browser.switch_to_frame(frame)
Expand Down
35 changes: 35 additions & 0 deletions test/acceptance/keywords/frames.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,45 @@ Frame Should Contain
Frame Should contain right You're looking at right.
Frame Should Contain left Links

Frame Should Contain should also work with iframes
[setup] Go To Page "frames/iframes.html"
Frame Should contain right You're looking at right.
Frame Should Contain left Links


Page Should Contain Text Within Frames
Page Should contain You're looking at right.
Page Should Contain Links

Page Should Contain Text Within Frames should also work with iframes
[setup] Go To Page "frames/iframes.html"
Page Should contain You're looking at right.
Page Should Contain Links


Select And Unselect Frame
[Documentation] LOG 2 Selecting frame 'left'.
Select Frame left
Click Link foo
Unselect Frame
Select Frame right
Current Frame Contains You're looking at foo.

Select And Unselect Frame should also work with iframes
[Documentation] LOG 2 Selecting frame 'leftiframe'.
[setup] Go To Page "frames/iframes.html"
Select Frame left
Click Link foo
Unselect Frame
Select Frame right
Current Frame Contains You're looking at foo.

Select Frame with non-unique name attribute
[Documentation] LOG 2 Descerning frame 'left' from link 'left'.
[setup] Go To Page "frames/poorlynamedframe.html"
Run Keyword And Expect Error NoSuchFrameException* Select Frame left
Select Frame xpath=//frame[@name='left']|//iframe[@name='left']
Click Link foo
Unselect Frame
Select Frame right
Current Frame Contains You're looking at foo.
4 changes: 4 additions & 0 deletions test/resources/html/frames/iframes.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<html>
<iframe name ="left" id="left" src="left.html"></iframe>
<iframe name="right" id="right" src="right.html"></iframe>
</html>
5 changes: 5 additions & 0 deletions test/resources/html/frames/poorlynamedframe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<a name="left" href="index.html">Relative</a><br>
<iframe name="left" id="left" src="left.html"></iframe>
<iframe name="right" id="right" src="right.html"></iframe>
</html>