Skip to content

Commit

Permalink
Select Frame doc cleanup (#971)
Browse files Browse the repository at this point in the history
  • Loading branch information
pekkaklarck authored and aaltat committed Oct 24, 2017
1 parent c123a74 commit 7bbfc20
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/SeleniumLibrary/keywords/frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,27 @@ class FrameKeywords(LibraryComponent):
def select_frame(self, locator):
"""Sets frame identified by ``locator`` as the current frame.
Key attributes for frames are `id` and `name.` See `introduction` for
details about locating elements.
See `Unselect Frame` to cancel the frame selection and return to the Main frame.
See the `Locating elements` section for details about the locator
syntax.
Please note that the frame search always start from the document root or main frame.
Works both with frames and iframes. Use `Unselect Frame` to cancel
the frame selection and return to the main frame.
Example:
| Select Frame | xpath: //frame[@name='top]/iframe[@name='left'] | # Selects the 'left' iframe |
| Click Link | foo | # Clicks link 'foo' in 'left' iframe |
| Unselect Frame | | # Returns to main frame |
| Select Frame | left | # Selects the 'top' frame |
| `Select Frame` | top-frame | # Select frame with id or name 'top-frame' |
| `Click Link` | example | # Click link 'example' in the selected frame |
| `Unselect Frame` | | # Back to main frame. |
| `Select Frame` | //iframe[@name='xxx'] | # Select frame using xpath |
"""
self.info("Selecting frame '%s'." % locator)
element = self.find_element(locator)
self.browser.switch_to.frame(element)

@keyword
def unselect_frame(self):
"""Sets the top frame as the current frame.
"""Sets the main frame as the current frame.
In practice cancels a previous `Select Frame` call.
In practice cancels the previous `Select Frame` call.
"""
self.browser.switch_to.default_content()

Expand Down

0 comments on commit 7bbfc20

Please sign in to comment.