Skip to content
Closed
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
6 changes: 4 additions & 2 deletions src/Selenium2Library/keywords/_browsermanagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,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):
Expand Down Expand Up @@ -366,4 +369,3 @@ def _make_browser(self, browser_name):
browser.set_script_timeout(self._timeout_in_secs)

return browser

18 changes: 15 additions & 3 deletions src/Selenium2Library/keywords/_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,13 @@ def get_value(self, locator):
See `introduction` for details about locating elements.
"""
return self._get_value(locator)

def get_text(self, locator):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This get_text is fine I'll go ahead and add it to the base, I'm not sure about the iFrame stuff though. Ed / Ryan any thought on the iFrame stuff?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested the iFrame related code in my real projects. They works fine, and the logic is very simple. Please merge into base as well, tks!

"""Returns the text value of element identified by `locator`.

See `introduction` for details about locating elements.
"""
return self._get_text(locator)

def get_vertical_position(self, locator):
"""Returns vertical position of element identified by `locator`.
Expand Down Expand Up @@ -507,7 +514,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, tag='iframe')
except ValueError:
element = self._element_find(locator, True, True, tag='frame')
browser.switch_to_frame(element)
self._info("Searching for text from frame '%s'." % locator)
found = self._is_text_present(text)
Expand Down Expand Up @@ -588,7 +598,10 @@ def _page_contains(self, text):
if self._is_text_present(text):
return True

subframes = self._element_find("tag=frame", False, False, 'frame')
try:
subframes = self._element_find("tag=iframe", False, False, 'iframe')
except ValueError:
subframes = 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)
Expand Down Expand Up @@ -619,4 +632,3 @@ def _page_should_not_contain_element(self, locator, tag, message, loglevel):
raise AssertionError(message)
self._info("Current page does not contain %s '%s'."
% (element_name, locator))