diff --git a/CHANGES.rst b/CHANGES.rst index dbdf867b5..d41f226b2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,10 @@ Release Notes - Added iframe support by removing strict filtering for only elements. [emanlove] +- Added the 'get text' keyword to be backwards compatible with the original + Selenium Library. + [jouk0] + 1.0.1 ----- - Support for Robot Framework 2.7 diff --git a/src/Selenium2Library/keywords/_element.py b/src/Selenium2Library/keywords/_element.py index bd12e86eb..c846c91cb 100644 --- a/src/Selenium2Library/keywords/_element.py +++ b/src/Selenium2Library/keywords/_element.py @@ -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): + """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`. diff --git a/test/acceptance/keywords/content_assertions.txt b/test/acceptance/keywords/content_assertions.txt index 4f55e11ee..5df4736c8 100644 --- a/test/acceptance/keywords/content_assertions.txt +++ b/test/acceptance/keywords/content_assertions.txt @@ -86,6 +86,10 @@ Element Text Should Be Element Text Should Be some_id This text is inside an identified element Run Keyword And Expect Error The text of element 'some_id' should have been 'inside' but in fact it was 'This text is inside an identified element'. Element Text Should Be some_id inside +Get Text + ${str} = Get Text some_id + Should Match ${str} This text is inside an identified element + Element Should Be Visible [Setup] Go To Page "visibility.html" Element Should Be Visible i_am_visible