diff --git a/src/Selenium2Library/keywords/_browsermanagement.py b/src/Selenium2Library/keywords/_browsermanagement.py index 5be1cdcdb..24198b0b9 100644 --- a/src/Selenium2Library/keywords/_browsermanagement.py +++ b/src/Selenium2Library/keywords/_browsermanagement.py @@ -173,7 +173,10 @@ def select_frame(self, locator): details about locating elements. """ self._info("Selecting frame '%s'." % locator) - element = self._element_find(locator, True, True, tag='frame') + try: + element = self._element_find(locator, True, True, tag='iframe') + except ValueError: + element = self._element_find(locator, True, True, tag='frame') self._current_browser().switch_to_frame(element) def select_window(self, locator=None): @@ -181,7 +184,7 @@ def select_window(self, locator=None): If the window is found, all subsequent commands use that window, until this keyword is used again. If the window is not found, this keyword fails. - + By default, when a locator value is provided, it is matched against the title of the window and the javascript name of the window. If multiple windows with diff --git a/src/Selenium2Library/keywords/_element.py b/src/Selenium2Library/keywords/_element.py index e107d526c..3f38b74a9 100644 --- a/src/Selenium2Library/keywords/_element.py +++ b/src/Selenium2Library/keywords/_element.py @@ -508,7 +508,10 @@ 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') + try: + element = self._element_find(locator, True, True, 'iframe') + except ValueError: + element = self._element_find(locator, True, True, 'frame') browser.switch_to_frame(element) self._info("Searching for text from frame '%s'." % locator) found = self._is_text_present(text) @@ -588,8 +591,8 @@ 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("tag=iframe", False, False, 'iframe') + \ + self._element_find("tag=frame", False, False, 'frame') self._debug('Current frame has %d subframes' % len(subframes)) for frame in subframes: browser.switch_to_frame(frame) diff --git a/test/acceptance/keywords/content_assertions.txt b/test/acceptance/keywords/content_assertions.txt index 4f55e11ee..84f352e21 100644 --- a/test/acceptance/keywords/content_assertions.txt +++ b/test/acceptance/keywords/content_assertions.txt @@ -40,6 +40,10 @@ Page Should Contain With Frames [Setup] Go To Page "frames/frameset.html" Page Should Contain You're looking at right. +Page Should Contain With IFrames + [Setup] Go To Page "frames/iframes.html" + Page Should Contain You're looking at right. + Page Should Not Contain [Documentation] LOG 2:5 Current page does not contain text 'non existing text'. LOG 3.1:4 REGEXP: (?i) Page Should Not Contain non existing text diff --git a/test/acceptance/keywords/frames.txt b/test/acceptance/keywords/frames.txt index 94e5bd8e3..6bcda908b 100644 --- a/test/acceptance/keywords/frames.txt +++ b/test/acceptance/keywords/frames.txt @@ -10,6 +10,12 @@ 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 + + Select And Unselect Frame [Documentation] LOG 2 Selecting frame 'left'. Select Frame left @@ -17,3 +23,12 @@ Select And Unselect Frame 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. \ No newline at end of file diff --git a/test/resources/html/frames/iframes.html b/test/resources/html/frames/iframes.html new file mode 100644 index 000000000..445ed72c2 --- /dev/null +++ b/test/resources/html/frames/iframes.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file