From 537841521a3cc2d874e7f711f4580ef428db16b9 Mon Sep 17 00:00:00 2001 From: Tatu Aalto Date: Sun, 7 Jun 2015 20:55:56 +0300 Subject: [PATCH 01/15] Added possibility to combine index and filename args If test are run, to get a custom and unique filename each time screenshot is takes, it would require creating blobal variable in RF data and making sure that variable in unique for each time screenshot is taken. This is now much easier to do with the index param in the Capture Page Screenshot keyword. --- src/Selenium2Library/keywords/_screenshot.py | 28 ++++++++++++++------ test/acceptance/keywords/screenshots.txt | 9 +++++++ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/Selenium2Library/keywords/_screenshot.py b/src/Selenium2Library/keywords/_screenshot.py index 74488f864..64b2d06eb 100644 --- a/src/Selenium2Library/keywords/_screenshot.py +++ b/src/Selenium2Library/keywords/_screenshot.py @@ -10,7 +10,7 @@ def __init__(self): # Public - def capture_page_screenshot(self, filename=None): + def capture_page_screenshot(self, filename=None, index=False): """Takes a screenshot of the current page and embeds it into the log. `filename` argument specifies the name of the file to write the @@ -19,14 +19,22 @@ def capture_page_screenshot(self, filename=None): the Robot Framework log file is written into. The `filename` is also considered relative to the same directory, if it is not given in absolute format. If an absolute or relative path is given - but the path does not exist it will be created. + but the path does not exist it will be created. - `css` can be used to modify how the screenshot is taken. By default - the bakground color is changed to avoid possible problems with - background leaking when the page layout is somehow broken. - """ - path, link = self._get_screenshot_paths(filename) + `index` with index argument it is possible to define custom filename + but each time get unique screen capture. Example if pabot is used + to run multiple test suites in paraler and correct screenshots should + be copied to log, then it is possible to use `filename` and + `index` argument to gether to create unique name for each screenshot. + Example: + | Open Browser | www.someurl.com | browser=${BROWSER} | + | Screen Capture | filename=${BROWSER}- | index=True | + | Screen Capture | filename=${BROWSER}- | index=True | + | File Should Exist | ${OUTPUTDIR}${/}${BROWSER}-1.png | + | File Should Exist | ${OUTPUTDIR}${/}${BROWSER}-2.png | + """ + path, link = self._get_screenshot_paths(filename, index=index) target_dir = os.path.dirname(path) if not os.path.exists(target_dir): try: @@ -49,10 +57,14 @@ def capture_page_screenshot(self, filename=None): # Private - def _get_screenshot_paths(self, filename): + def _get_screenshot_paths(self, filename, index=False): if not filename: self._screenshot_index += 1 filename = 'selenium-screenshot-%d.png' % self._screenshot_index + elif filename and index: + self._screenshot_index += 1 + filename = filename.replace('/', os.sep) + \ + str(self._screenshot_index) + '.png' else: filename = filename.replace('/', os.sep) logdir = self._get_log_dir() diff --git a/test/acceptance/keywords/screenshots.txt b/test/acceptance/keywords/screenshots.txt index b822ba4f7..975e2ac67 100644 --- a/test/acceptance/keywords/screenshots.txt +++ b/test/acceptance/keywords/screenshots.txt @@ -31,3 +31,12 @@ Capture page screenshot to non-existing directory [Setup] Remove Directory ${OUTPUTDIR}/screenshot recursive Capture Page Screenshot screenshot/test-screenshot.png File Should Exist ${OUTPUTDIR}/screenshot/test-screenshot.png + +Capture page screenshot to with index + [Setup] Remove Directory ${OUTPUTDIR}/screenshot-index recursive + Capture Page Screenshot screenshot-index/some-name- index=True + File Should Exist ${OUTPUTDIR}/screenshot-index/some-name-3.png + Capture Page Screenshot screenshot-index/some-name- index=${True} + File Should Exist ${OUTPUTDIR}/screenshot-index/some-name-4.png + Capture Page Screenshot index=True + File Should Exist ${OUTPUTDIR}/selenium-screenshot-5.png From 17a7c0cc38ec635c2573c97ac6e8dd56d91a2ae5 Mon Sep 17 00:00:00 2001 From: Tatu Aalto Date: Sun, 7 Jun 2015 22:07:01 +0300 Subject: [PATCH 02/15] Fixed the typo in Capture Page Screenshot documentation. --- src/Selenium2Library/keywords/_screenshot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Selenium2Library/keywords/_screenshot.py b/src/Selenium2Library/keywords/_screenshot.py index 64b2d06eb..d1f6d1b8f 100644 --- a/src/Selenium2Library/keywords/_screenshot.py +++ b/src/Selenium2Library/keywords/_screenshot.py @@ -23,7 +23,7 @@ def capture_page_screenshot(self, filename=None, index=False): `index` with index argument it is possible to define custom filename but each time get unique screen capture. Example if pabot is used - to run multiple test suites in paraler and correct screenshots should + to run multiple test suites in paraller and correct screenshots should be copied to log, then it is possible to use `filename` and `index` argument to gether to create unique name for each screenshot. From d546c119fabe47e37f951592588b74491be85ac5 Mon Sep 17 00:00:00 2001 From: Tatu Aalto Date: Wed, 10 Jun 2015 00:09:21 +0300 Subject: [PATCH 03/15] Re-facotred screenshot code based on comments Now if the filename exist, new one is created by adding counter in the end (but before .png). All the existing acceptance tests do pass and where not modified. New ones where modified to meet the new requirements. --- src/Selenium2Library/keywords/_screenshot.py | 61 +++++++++++++------- test/acceptance/keywords/screenshots.txt | 28 ++++++--- 2 files changed, 62 insertions(+), 27 deletions(-) diff --git a/src/Selenium2Library/keywords/_screenshot.py b/src/Selenium2Library/keywords/_screenshot.py index d1f6d1b8f..6fe1dde0d 100644 --- a/src/Selenium2Library/keywords/_screenshot.py +++ b/src/Selenium2Library/keywords/_screenshot.py @@ -10,31 +10,39 @@ def __init__(self): # Public - def capture_page_screenshot(self, filename=None, index=False): + def capture_page_screenshot(self, filename=None, overwrite=False): """Takes a screenshot of the current page and embeds it into the log. `filename` argument specifies the name of the file to write the - screenshot into. If no `filename` is given, the screenshot is saved into file - `selenium-screenshot-.png` under the directory where - the Robot Framework log file is written into. The `filename` is + screenshot into. If no `filename` is given, the screenshot is + saved into file `selenium-screenshot-.png` under the directory + where the Robot Framework log file is written into. The `filename` is also considered relative to the same directory, if it is not given in absolute format. If an absolute or relative path is given but the path does not exist it will be created. - `index` with index argument it is possible to define custom filename - but each time get unique screen capture. Example if pabot is used - to run multiple test suites in paraller and correct screenshots should - be copied to log, then it is possible to use `filename` and - `index` argument to gether to create unique name for each screenshot. + With `overwrite` it is possible to define what is done if file already + exist. By default filename is not overwritten but new one is created + by adding in the end. Example if capture.png exist and + this is the first overwrite, then new file is created with name + capture-1.png Example: | Open Browser | www.someurl.com | browser=${BROWSER} | - | Screen Capture | filename=${BROWSER}- | index=True | - | Screen Capture | filename=${BROWSER}- | index=True | + | Screen Capture | filename=${BROWSER} | + | Screen Capture | filename=${BROWSER} | + | File Should Exist | ${OUTPUTDIR}${/}${BROWSER}.png | | File Should Exist | ${OUTPUTDIR}${/}${BROWSER}-1.png | - | File Should Exist | ${OUTPUTDIR}${/}${BROWSER}-2.png | + | Screen Capture | + | Screen Capture | + | File Should Exist | ${OUTPUTDIR}${/}selenium-screenshot-2.png | + | File Should Exist | ${OUTPUTDIR}${/}selenium-screenshot-3.png | + | Screen Capture | filename=${BROWSER}.png | overwrite=${True} | + | Screen Capture | filename=${BROWSER}.png | overwrite=${True} | + | File Should Exist | ${OUTPUTDIR}${/}${BROWSER}.png | + | File Should Not Exist | ${OUTPUTDIR}${/}overwrite-${BROWSER}-4.png | """ - path, link = self._get_screenshot_paths(filename, index=index) + path, link = self._get_screenshot_paths(filename, overwrite=overwrite) target_dir = os.path.dirname(path) if not os.path.exists(target_dir): try: @@ -57,17 +65,30 @@ def capture_page_screenshot(self, filename=None, index=False): # Private - def _get_screenshot_paths(self, filename, index=False): + def _get_screenshot_paths(self, filename, overwrite=False): if not filename: self._screenshot_index += 1 filename = 'selenium-screenshot-%d.png' % self._screenshot_index - elif filename and index: - self._screenshot_index += 1 - filename = filename.replace('/', os.sep) + \ - str(self._screenshot_index) + '.png' + elif filename and not overwrite: + filename = self._screenshot_existence(filename.replace('/', + os.sep)) else: filename = filename.replace('/', os.sep) - logdir = self._get_log_dir() - path = os.path.join(logdir, filename) + path, logdir = self._get_logdir_path(filename) link = robot.utils.get_link_path(path, logdir) return path, link + + def _screenshot_existence(self, filename): + if os.path.exists(self._get_logdir_path(filename)[0]): + self._screenshot_index += 1 + try: + return '-%s.png'.join(filename.rsplit('.png', 1)) \ + % self._screenshot_index + except TypeError: + return filename + '-%s' % self._screenshot_index + else: + return filename + + def _get_logdir_path(self, filename): + logdir = self._get_log_dir() + return os.path.join(logdir, filename), logdir diff --git a/test/acceptance/keywords/screenshots.txt b/test/acceptance/keywords/screenshots.txt index 975e2ac67..ee5b28a68 100644 --- a/test/acceptance/keywords/screenshots.txt +++ b/test/acceptance/keywords/screenshots.txt @@ -32,11 +32,25 @@ Capture page screenshot to non-existing directory Capture Page Screenshot screenshot/test-screenshot.png File Should Exist ${OUTPUTDIR}/screenshot/test-screenshot.png -Capture page screenshot to with index - [Setup] Remove Directory ${OUTPUTDIR}/screenshot-index recursive - Capture Page Screenshot screenshot-index/some-name- index=True - File Should Exist ${OUTPUTDIR}/screenshot-index/some-name-3.png - Capture Page Screenshot screenshot-index/some-name- index=${True} - File Should Exist ${OUTPUTDIR}/screenshot-index/some-name-4.png - Capture Page Screenshot index=True +Capture page screenshot to with overwrite + [Setup] Remove Directory ${OUTPUTDIR}/screenshot-overwrite recursive + Capture Page Screenshot screenshot-overwrite/some-name.png + File Should Exist ${OUTPUTDIR}/screenshot-overwrite/some-name.png + Capture Page Screenshot screenshot-overwrite/some-name.png + File Should Exist ${OUTPUTDIR}/screenshot-overwrite/some-name-3.png + Capture Page Screenshot overwrite=True + Capture Page Screenshot overwrite=True File Should Exist ${OUTPUTDIR}/selenium-screenshot-5.png + File Should Not Exist ${OUTPUTDIR}/selenium-screenshot-6.png + Capture Page Screenshot overwrite-filename.png overwrite=True + Capture Page Screenshot overwrite-filename.png overwrite=True + File Should Exist ${OUTPUTDIR}/overwrite-filename.png + File Should Not Exist ${OUTPUTDIR}/overwrite-filename-6.png + Capture Page Screenshot many.png.and.dots.png + Capture Page Screenshot many.png.and.dots.png + File Should Exist ${OUTPUTDIR}/many.png.and.dots.png + File Should Exist ${OUTPUTDIR}/many.png.and.dots-6.png + Capture Page Screenshot no-png-in-end + Capture Page Screenshot no-png-in-end + File Should Exist ${OUTPUTDIR}/no-png-in-end + File Should Exist ${OUTPUTDIR}/no-png-in-end-7 From 38de2b424e33563ec2a748a8d2c5300b74d4bceb Mon Sep 17 00:00:00 2001 From: Tatu Aalto Date: Wed, 10 Jun 2015 23:20:09 +0300 Subject: [PATCH 04/15] Changed index to be unique for each filename Now for each filename, there is unique index saved in a dictionary. This makes the end result, the screenshots, more easier to read and maintain. --- src/Selenium2Library/keywords/_screenshot.py | 30 +++++++++++++++----- test/acceptance/keywords/screenshots.txt | 18 +++++++----- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/Selenium2Library/keywords/_screenshot.py b/src/Selenium2Library/keywords/_screenshot.py index 6fe1dde0d..90f3fcbee 100644 --- a/src/Selenium2Library/keywords/_screenshot.py +++ b/src/Selenium2Library/keywords/_screenshot.py @@ -6,7 +6,7 @@ class _ScreenshotKeywords(KeywordGroup): def __init__(self): - self._screenshot_index = 0 + self._screenshot_index = {} # Public @@ -41,6 +41,14 @@ def capture_page_screenshot(self, filename=None, overwrite=False): | Screen Capture | filename=${BROWSER}.png | overwrite=${True} | | File Should Exist | ${OUTPUTDIR}${/}${BROWSER}.png | | File Should Not Exist | ${OUTPUTDIR}${/}overwrite-${BROWSER}-4.png | + + *NOTE:* The `overwrite` is ignored if `filename` is not defined + Example: + | Open Browser | www.someurl.com | browser=${BROWSER} | + | Screen Capture | overwrite=${True} | # overwrite is ignored | + | Screen Capture | overwrite=${True} | # overwrite is ignored | + | File Should Exist | ${OUTPUTDIR}${/}selenium-screenshot-1.png | + | File Should Exist | ${OUTPUTDIR}${/}selenium-screenshot-2.png | """ path, link = self._get_screenshot_paths(filename, overwrite=overwrite) target_dir = os.path.dirname(path) @@ -67,8 +75,8 @@ def capture_page_screenshot(self, filename=None, overwrite=False): def _get_screenshot_paths(self, filename, overwrite=False): if not filename: - self._screenshot_index += 1 - filename = 'selenium-screenshot-%d.png' % self._screenshot_index + index = self._get_new_index('selenium-screenshot') + filename = 'selenium-screenshot-%d.png' % index elif filename and not overwrite: filename = self._screenshot_existence(filename.replace('/', os.sep)) @@ -80,15 +88,23 @@ def _get_screenshot_paths(self, filename, overwrite=False): def _screenshot_existence(self, filename): if os.path.exists(self._get_logdir_path(filename)[0]): - self._screenshot_index += 1 + index = self._get_new_index(filename) try: - return '-%s.png'.join(filename.rsplit('.png', 1)) \ - % self._screenshot_index + return '-%s.png'.join(filename.rsplit('.png', 1)) % index except TypeError: - return filename + '-%s' % self._screenshot_index + return filename + '-%s' % index else: return filename def _get_logdir_path(self, filename): logdir = self._get_log_dir() return os.path.join(logdir, filename), logdir + + def _get_new_index(self, filename): + try: + index = self._screenshot_index[filename] + 1 + self._screenshot_index[filename] = index + return index + except KeyError: + self._screenshot_index[filename] = 1 + return 1 diff --git a/test/acceptance/keywords/screenshots.txt b/test/acceptance/keywords/screenshots.txt index ee5b28a68..e86a28327 100644 --- a/test/acceptance/keywords/screenshots.txt +++ b/test/acceptance/keywords/screenshots.txt @@ -32,25 +32,29 @@ Capture page screenshot to non-existing directory Capture Page Screenshot screenshot/test-screenshot.png File Should Exist ${OUTPUTDIR}/screenshot/test-screenshot.png -Capture page screenshot to with overwrite +Capture page screenshot to with overwrite false and custom name [Setup] Remove Directory ${OUTPUTDIR}/screenshot-overwrite recursive Capture Page Screenshot screenshot-overwrite/some-name.png File Should Exist ${OUTPUTDIR}/screenshot-overwrite/some-name.png Capture Page Screenshot screenshot-overwrite/some-name.png - File Should Exist ${OUTPUTDIR}/screenshot-overwrite/some-name-3.png + File Should Exist ${OUTPUTDIR}/screenshot-overwrite/some-name-1.png + +Capture page screenshot to with overwrite true Capture Page Screenshot overwrite=True Capture Page Screenshot overwrite=True - File Should Exist ${OUTPUTDIR}/selenium-screenshot-5.png - File Should Not Exist ${OUTPUTDIR}/selenium-screenshot-6.png + File Should Exist ${OUTPUTDIR}/selenium-screenshot-3.png + File Should Exist ${OUTPUTDIR}/selenium-screenshot-4.png Capture Page Screenshot overwrite-filename.png overwrite=True Capture Page Screenshot overwrite-filename.png overwrite=True File Should Exist ${OUTPUTDIR}/overwrite-filename.png - File Should Not Exist ${OUTPUTDIR}/overwrite-filename-6.png + File Should Not Exist ${OUTPUTDIR}/overwrite-filename-1.png + +Capture page screenshot with complex names Capture Page Screenshot many.png.and.dots.png Capture Page Screenshot many.png.and.dots.png File Should Exist ${OUTPUTDIR}/many.png.and.dots.png - File Should Exist ${OUTPUTDIR}/many.png.and.dots-6.png + File Should Exist ${OUTPUTDIR}/many.png.and.dots-1.png Capture Page Screenshot no-png-in-end Capture Page Screenshot no-png-in-end File Should Exist ${OUTPUTDIR}/no-png-in-end - File Should Exist ${OUTPUTDIR}/no-png-in-end-7 + File Should Exist ${OUTPUTDIR}/no-png-in-end-1 From eb235fa1ccf866f24cfac85d572e2e84a251afc4 Mon Sep 17 00:00:00 2001 From: Tatu Aalto Date: Mon, 15 Jun 2015 21:13:42 +0300 Subject: [PATCH 05/15] Fixed keyword documentation for Capture Page Screenshot --- src/Selenium2Library/keywords/_screenshot.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Selenium2Library/keywords/_screenshot.py b/src/Selenium2Library/keywords/_screenshot.py index 90f3fcbee..911e4b94f 100644 --- a/src/Selenium2Library/keywords/_screenshot.py +++ b/src/Selenium2Library/keywords/_screenshot.py @@ -29,24 +29,26 @@ def capture_page_screenshot(self, filename=None, overwrite=False): Example: | Open Browser | www.someurl.com | browser=${BROWSER} | - | Screen Capture | filename=${BROWSER} | - | Screen Capture | filename=${BROWSER} | + | Capture Page Screenshot | filename=${BROWSER} | + | Capture Page Screenshot | filename=${BROWSER} | + | Capture Page Screenshot | filename=${BROWSER} | | File Should Exist | ${OUTPUTDIR}${/}${BROWSER}.png | | File Should Exist | ${OUTPUTDIR}${/}${BROWSER}-1.png | - | Screen Capture | - | Screen Capture | + | File Should Exist | ${OUTPUTDIR}${/}${BROWSER}-2.png | + | Capture Page Screenshot | + | Capture Page Screenshot | + | File Should Exist | ${OUTPUTDIR}${/}selenium-screenshot-1.png | | File Should Exist | ${OUTPUTDIR}${/}selenium-screenshot-2.png | - | File Should Exist | ${OUTPUTDIR}${/}selenium-screenshot-3.png | - | Screen Capture | filename=${BROWSER}.png | overwrite=${True} | - | Screen Capture | filename=${BROWSER}.png | overwrite=${True} | + | Capture Page Screenshot | filename=${BROWSER}.png | overwrite=${True} | + | Capture Page Screenshot | filename=${BROWSER}.png | overwrite=${True} | | File Should Exist | ${OUTPUTDIR}${/}${BROWSER}.png | | File Should Not Exist | ${OUTPUTDIR}${/}overwrite-${BROWSER}-4.png | *NOTE:* The `overwrite` is ignored if `filename` is not defined Example: | Open Browser | www.someurl.com | browser=${BROWSER} | - | Screen Capture | overwrite=${True} | # overwrite is ignored | - | Screen Capture | overwrite=${True} | # overwrite is ignored | + | Capture Page Screenshot | overwrite=${True} | # overwrite is ignored | + | Capture Page Screenshot | overwrite=${True} | # overwrite is ignored | | File Should Exist | ${OUTPUTDIR}${/}selenium-screenshot-1.png | | File Should Exist | ${OUTPUTDIR}${/}selenium-screenshot-2.png | """ From 2ceb29e87b0c8a9157956c6eddcdb6dbe8a9c840 Mon Sep 17 00:00:00 2001 From: Tatu Aalto Date: Mon, 15 Jun 2015 21:18:41 +0300 Subject: [PATCH 06/15] New modification to Capture Page Screenshot keyword documentation. --- src/Selenium2Library/keywords/_screenshot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Selenium2Library/keywords/_screenshot.py b/src/Selenium2Library/keywords/_screenshot.py index 911e4b94f..5193335db 100644 --- a/src/Selenium2Library/keywords/_screenshot.py +++ b/src/Selenium2Library/keywords/_screenshot.py @@ -39,10 +39,10 @@ def capture_page_screenshot(self, filename=None, overwrite=False): | Capture Page Screenshot | | File Should Exist | ${OUTPUTDIR}${/}selenium-screenshot-1.png | | File Should Exist | ${OUTPUTDIR}${/}selenium-screenshot-2.png | - | Capture Page Screenshot | filename=${BROWSER}.png | overwrite=${True} | - | Capture Page Screenshot | filename=${BROWSER}.png | overwrite=${True} | - | File Should Exist | ${OUTPUTDIR}${/}${BROWSER}.png | - | File Should Not Exist | ${OUTPUTDIR}${/}overwrite-${BROWSER}-4.png | + | Capture Page Screenshot | filename=DefaultName.png | overwrite=${True} | + | Capture Page Screenshot | filename=DefaultName.png | overwrite=${True} | + | File Should Exist | ${OUTPUTDIR}${/}DefaultName.png | + | File Should Not Exist | ${OUTPUTDIR}${/}DefaultName-1.png | *NOTE:* The `overwrite` is ignored if `filename` is not defined Example: From a27e612ce96a5c34eb5cf7a7a9f663cfedd160ce Mon Sep 17 00:00:00 2001 From: zephraph Date: Wed, 17 Jun 2015 13:53:13 -0500 Subject: [PATCH 07/15] Hotfix for RF 2.9 --- CHANGES.rst | 6 ++++- src/Selenium2Library/keywords/_logging.py | 9 ++++--- .../keywords/_tableelement.py | 27 +++++++++---------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 112d18b4a..974af79a9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,11 @@ Release Notes ============= -1.7 +1.7.1 (hotfix) +---------------- +- Remove references to GLOBAL_VARIABLES for RF 2.9 compatibility + +1.7 ---------------- - Added keyword 'List Windows' to return a list of all window handles. [divfor] diff --git a/src/Selenium2Library/keywords/_logging.py b/src/Selenium2Library/keywords/_logging.py index bea494247..142ba1fde 100644 --- a/src/Selenium2Library/keywords/_logging.py +++ b/src/Selenium2Library/keywords/_logging.py @@ -1,6 +1,6 @@ import os import sys -from robot.variables import GLOBAL_VARIABLES +from robot.libraries.BuiltIn import BuiltIn from robot.api import logger from keywordgroup import KeywordGroup @@ -12,10 +12,11 @@ def _debug(self, message): logger.debug(message) def _get_log_dir(self): - logfile = GLOBAL_VARIABLES['${LOG FILE}'] + variables = BuiltIn().get_variables() + logfile = variables['${LOG FILE}'] if logfile != 'NONE': return os.path.dirname(logfile) - return GLOBAL_VARIABLES['${OUTPUTDIR}'] + return variables['${OUTPUTDIR}'] def _html(self, message): logger.info(message, True, False) @@ -38,4 +39,4 @@ def _log_list(self, items, what='item'): return items def _warn(self, message): - logger.warn(message) \ No newline at end of file + logger.warn(message) diff --git a/src/Selenium2Library/keywords/_tableelement.py b/src/Selenium2Library/keywords/_tableelement.py index 0cf5183f2..330790d30 100644 --- a/src/Selenium2Library/keywords/_tableelement.py +++ b/src/Selenium2Library/keywords/_tableelement.py @@ -1,6 +1,5 @@ import os import sys -from robot.variables import GLOBAL_VARIABLES from robot.api import logger from Selenium2Library.locators import TableElementFinder from keywordgroup import KeywordGroup @@ -17,10 +16,10 @@ def get_table_cell(self, table_locator, row, column, loglevel='INFO'): Row and column number start from 1. Header and footer rows are included in the count. A negative row or column number can be used - to get rows counting from the end (end: -1). Cell content from header - or footer rows can be obtained with this keyword. To understand how + to get rows counting from the end (end: -1). Cell content from header + or footer rows can be obtained with this keyword. To understand how tables are identified, please take a look at the `introduction`. - + See `Page Should Contain` for explanation about `loglevel` argument. """ row = int(row) @@ -32,13 +31,13 @@ def get_table_cell(self, table_locator, row, column, loglevel='INFO'): table = self._table_element_finder.find(self._current_browser(), table_locator) if table is not None: rows = table.find_elements_by_xpath("./thead/tr") - if row_index >= len(rows) or row_index < 0: + if row_index >= len(rows) or row_index < 0: rows.extend(table.find_elements_by_xpath("./tbody/tr")) - if row_index >= len(rows) or row_index < 0: + if row_index >= len(rows) or row_index < 0: rows.extend(table.find_elements_by_xpath("./tfoot/tr")) if row_index < len(rows): columns = rows[row_index].find_elements_by_tag_name('th') - if column_index >= len(columns) or column_index < 0: + if column_index >= len(columns) or column_index < 0: columns.extend(rows[row_index].find_elements_by_tag_name('td')) if column_index < len(columns): return columns[column_index].text @@ -58,7 +57,7 @@ def table_cell_should_contain(self, table_locator, row, column, expected, loglev To understand how tables are identified, please take a look at the `introduction`. - + See `Page Should Contain` for explanation about `loglevel` argument. """ message = ("Cell in table '%s' in row #%s and column #%s " @@ -78,7 +77,7 @@ def table_cell_should_contain(self, table_locator, row, column, expected, loglev def table_column_should_contain(self, table_locator, col, expected, loglevel='INFO'): """Verifies that a specific column contains `expected`. - The first leftmost column is column number 1. A negative column + The first leftmost column is column number 1. A negative column number can be used to get column counting from the end of the row (end: -1). If the table contains cells that span multiple columns, those merged cells count as a single column. For example both tests below work, @@ -136,10 +135,10 @@ def table_header_should_contain(self, table_locator, expected, loglevel='INFO'): def table_row_should_contain(self, table_locator, row, expected, loglevel='INFO'): """Verifies that a specific table row contains `expected`. - The uppermost row is row number 1. A negative column - number can be used to get column counting from the end of the row - (end: -1). For tables that are structured with thead, tbody and tfoot, - only the tbody section is searched. Please use `Table Header Should Contain` + The uppermost row is row number 1. A negative column + number can be used to get column counting from the end of the row + (end: -1). For tables that are structured with thead, tbody and tfoot, + only the tbody section is searched. Please use `Table Header Should Contain` or `Table Footer Should Contain` for tests against the header or footer content. @@ -169,4 +168,4 @@ def table_should_contain(self, table_locator, expected, loglevel='INFO'): if element is None: self.log_source(loglevel) raise AssertionError("Table identified by '%s' should have contained text '%s'." \ - % (table_locator, expected)) \ No newline at end of file + % (table_locator, expected)) From d6284532a2bb9b593184414e2ba5b9d48d6d7e33 Mon Sep 17 00:00:00 2001 From: zephraph Date: Wed, 17 Jun 2015 20:37:29 -0500 Subject: [PATCH 08/15] Prepare for 1.7.1 release --- src/Selenium2Library/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Selenium2Library/version.py b/src/Selenium2Library/version.py index 81af48306..f4dc8dec6 100644 --- a/src/Selenium2Library/version.py +++ b/src/Selenium2Library/version.py @@ -1 +1 @@ -VERSION = '1.7.0' +VERSION = '1.7.1' From 64a0fd887e3a1f7690c751feb03929cd195ae34d Mon Sep 17 00:00:00 2001 From: zephraph Date: Thu, 25 Jun 2015 15:12:53 -0500 Subject: [PATCH 09/15] Changed test extensions to .robot --- test/acceptance/{__init__.txt => __init__.robot} | 0 test/acceptance/{create_webdriver.txt => create_webdriver.robot} | 0 test/acceptance/keywords/{__init__.txt => __init__.robot} | 0 .../keywords/{async_javascript.txt => async_javascript.robot} | 0 ...box_and_radio_buttons.txt => checkbox_and_radio_buttons.robot} | 0 .../keywords/{click_element.txt => click_element.robot} | 0 ...ment_at_coordinates.txt => click_element_at_coordinates.robot} | 0 .../keywords/{content_assertions.txt => content_assertions.robot} | 0 ..._disabled.txt => element_should_be_enabled_and_disabled.robot} | 0 test/acceptance/keywords/{elements.txt => elements.robot} | 0 .../keywords/{forms_and_buttons.txt => forms_and_buttons.robot} | 0 test/acceptance/keywords/{frames.txt => frames.robot} | 0 test/acceptance/keywords/{javascript.txt => javascript.robot} | 0 test/acceptance/keywords/{lists.txt => lists.robot} | 0 test/acceptance/keywords/{mouse.txt => mouse.robot} | 0 test/acceptance/keywords/{navigation.txt => navigation.robot} | 0 .../keywords/{run_on_failure.txt => run_on_failure.robot} | 0 test/acceptance/keywords/{screenshots.txt => screenshots.robot} | 0 test/acceptance/keywords/tables/{__init__.txt => __init__.robot} | 0 .../tables/{col_should_contain.txt => col_should_contain.robot} | 0 .../keywords/tables/{finding_tables.txt => finding_tables.robot} | 0 .../{footer_should_contain.txt => footer_should_contain.robot} | 0 .../keywords/tables/{get_table_cell.txt => get_table_cell.robot} | 0 .../{header_should_contain.txt => header_should_contain.robot} | 0 .../tables/{negative_indexes.txt => negative_indexes.robot} | 0 .../tables/{row_should_contain.txt => row_should_contain.robot} | 0 .../keywords/tables/{table_resource.txt => table_resource.robot} | 0 .../{table_should_contain.txt => table_should_contain.robot} | 0 test/acceptance/keywords/{textfields.txt => textfields.robot} | 0 test/acceptance/keywords/{waiting.txt => waiting.robot} | 0 test/acceptance/locators/{__init__.txt => __init__.robot} | 0 test/acceptance/locators/{custom.txt => custom.robot} | 0 test/acceptance/locators/{sizzle.txt => sizzle.robot} | 0 .../acceptance/{multiple_browsers.txt => multiple_browsers.robot} | 0 test/acceptance/{open_and_close.txt => open_and_close.robot} | 0 test/acceptance/{resource.txt => resource.robot} | 0 test/acceptance/{windows.txt => windows.robot} | 0 37 files changed, 0 insertions(+), 0 deletions(-) rename test/acceptance/{__init__.txt => __init__.robot} (100%) rename test/acceptance/{create_webdriver.txt => create_webdriver.robot} (100%) rename test/acceptance/keywords/{__init__.txt => __init__.robot} (100%) rename test/acceptance/keywords/{async_javascript.txt => async_javascript.robot} (100%) rename test/acceptance/keywords/{checkbox_and_radio_buttons.txt => checkbox_and_radio_buttons.robot} (100%) rename test/acceptance/keywords/{click_element.txt => click_element.robot} (100%) rename test/acceptance/keywords/{click_element_at_coordinates.txt => click_element_at_coordinates.robot} (100%) rename test/acceptance/keywords/{content_assertions.txt => content_assertions.robot} (100%) rename test/acceptance/keywords/{element_should_be_enabled_and_disabled.txt => element_should_be_enabled_and_disabled.robot} (100%) rename test/acceptance/keywords/{elements.txt => elements.robot} (100%) rename test/acceptance/keywords/{forms_and_buttons.txt => forms_and_buttons.robot} (100%) rename test/acceptance/keywords/{frames.txt => frames.robot} (100%) rename test/acceptance/keywords/{javascript.txt => javascript.robot} (100%) rename test/acceptance/keywords/{lists.txt => lists.robot} (100%) rename test/acceptance/keywords/{mouse.txt => mouse.robot} (100%) rename test/acceptance/keywords/{navigation.txt => navigation.robot} (100%) rename test/acceptance/keywords/{run_on_failure.txt => run_on_failure.robot} (100%) rename test/acceptance/keywords/{screenshots.txt => screenshots.robot} (100%) rename test/acceptance/keywords/tables/{__init__.txt => __init__.robot} (100%) rename test/acceptance/keywords/tables/{col_should_contain.txt => col_should_contain.robot} (100%) rename test/acceptance/keywords/tables/{finding_tables.txt => finding_tables.robot} (100%) rename test/acceptance/keywords/tables/{footer_should_contain.txt => footer_should_contain.robot} (100%) rename test/acceptance/keywords/tables/{get_table_cell.txt => get_table_cell.robot} (100%) rename test/acceptance/keywords/tables/{header_should_contain.txt => header_should_contain.robot} (100%) rename test/acceptance/keywords/tables/{negative_indexes.txt => negative_indexes.robot} (100%) rename test/acceptance/keywords/tables/{row_should_contain.txt => row_should_contain.robot} (100%) rename test/acceptance/keywords/tables/{table_resource.txt => table_resource.robot} (100%) rename test/acceptance/keywords/tables/{table_should_contain.txt => table_should_contain.robot} (100%) rename test/acceptance/keywords/{textfields.txt => textfields.robot} (100%) rename test/acceptance/keywords/{waiting.txt => waiting.robot} (100%) rename test/acceptance/locators/{__init__.txt => __init__.robot} (100%) rename test/acceptance/locators/{custom.txt => custom.robot} (100%) rename test/acceptance/locators/{sizzle.txt => sizzle.robot} (100%) rename test/acceptance/{multiple_browsers.txt => multiple_browsers.robot} (100%) rename test/acceptance/{open_and_close.txt => open_and_close.robot} (100%) rename test/acceptance/{resource.txt => resource.robot} (100%) rename test/acceptance/{windows.txt => windows.robot} (100%) diff --git a/test/acceptance/__init__.txt b/test/acceptance/__init__.robot similarity index 100% rename from test/acceptance/__init__.txt rename to test/acceptance/__init__.robot diff --git a/test/acceptance/create_webdriver.txt b/test/acceptance/create_webdriver.robot similarity index 100% rename from test/acceptance/create_webdriver.txt rename to test/acceptance/create_webdriver.robot diff --git a/test/acceptance/keywords/__init__.txt b/test/acceptance/keywords/__init__.robot similarity index 100% rename from test/acceptance/keywords/__init__.txt rename to test/acceptance/keywords/__init__.robot diff --git a/test/acceptance/keywords/async_javascript.txt b/test/acceptance/keywords/async_javascript.robot similarity index 100% rename from test/acceptance/keywords/async_javascript.txt rename to test/acceptance/keywords/async_javascript.robot diff --git a/test/acceptance/keywords/checkbox_and_radio_buttons.txt b/test/acceptance/keywords/checkbox_and_radio_buttons.robot similarity index 100% rename from test/acceptance/keywords/checkbox_and_radio_buttons.txt rename to test/acceptance/keywords/checkbox_and_radio_buttons.robot diff --git a/test/acceptance/keywords/click_element.txt b/test/acceptance/keywords/click_element.robot similarity index 100% rename from test/acceptance/keywords/click_element.txt rename to test/acceptance/keywords/click_element.robot diff --git a/test/acceptance/keywords/click_element_at_coordinates.txt b/test/acceptance/keywords/click_element_at_coordinates.robot similarity index 100% rename from test/acceptance/keywords/click_element_at_coordinates.txt rename to test/acceptance/keywords/click_element_at_coordinates.robot diff --git a/test/acceptance/keywords/content_assertions.txt b/test/acceptance/keywords/content_assertions.robot similarity index 100% rename from test/acceptance/keywords/content_assertions.txt rename to test/acceptance/keywords/content_assertions.robot diff --git a/test/acceptance/keywords/element_should_be_enabled_and_disabled.txt b/test/acceptance/keywords/element_should_be_enabled_and_disabled.robot similarity index 100% rename from test/acceptance/keywords/element_should_be_enabled_and_disabled.txt rename to test/acceptance/keywords/element_should_be_enabled_and_disabled.robot diff --git a/test/acceptance/keywords/elements.txt b/test/acceptance/keywords/elements.robot similarity index 100% rename from test/acceptance/keywords/elements.txt rename to test/acceptance/keywords/elements.robot diff --git a/test/acceptance/keywords/forms_and_buttons.txt b/test/acceptance/keywords/forms_and_buttons.robot similarity index 100% rename from test/acceptance/keywords/forms_and_buttons.txt rename to test/acceptance/keywords/forms_and_buttons.robot diff --git a/test/acceptance/keywords/frames.txt b/test/acceptance/keywords/frames.robot similarity index 100% rename from test/acceptance/keywords/frames.txt rename to test/acceptance/keywords/frames.robot diff --git a/test/acceptance/keywords/javascript.txt b/test/acceptance/keywords/javascript.robot similarity index 100% rename from test/acceptance/keywords/javascript.txt rename to test/acceptance/keywords/javascript.robot diff --git a/test/acceptance/keywords/lists.txt b/test/acceptance/keywords/lists.robot similarity index 100% rename from test/acceptance/keywords/lists.txt rename to test/acceptance/keywords/lists.robot diff --git a/test/acceptance/keywords/mouse.txt b/test/acceptance/keywords/mouse.robot similarity index 100% rename from test/acceptance/keywords/mouse.txt rename to test/acceptance/keywords/mouse.robot diff --git a/test/acceptance/keywords/navigation.txt b/test/acceptance/keywords/navigation.robot similarity index 100% rename from test/acceptance/keywords/navigation.txt rename to test/acceptance/keywords/navigation.robot diff --git a/test/acceptance/keywords/run_on_failure.txt b/test/acceptance/keywords/run_on_failure.robot similarity index 100% rename from test/acceptance/keywords/run_on_failure.txt rename to test/acceptance/keywords/run_on_failure.robot diff --git a/test/acceptance/keywords/screenshots.txt b/test/acceptance/keywords/screenshots.robot similarity index 100% rename from test/acceptance/keywords/screenshots.txt rename to test/acceptance/keywords/screenshots.robot diff --git a/test/acceptance/keywords/tables/__init__.txt b/test/acceptance/keywords/tables/__init__.robot similarity index 100% rename from test/acceptance/keywords/tables/__init__.txt rename to test/acceptance/keywords/tables/__init__.robot diff --git a/test/acceptance/keywords/tables/col_should_contain.txt b/test/acceptance/keywords/tables/col_should_contain.robot similarity index 100% rename from test/acceptance/keywords/tables/col_should_contain.txt rename to test/acceptance/keywords/tables/col_should_contain.robot diff --git a/test/acceptance/keywords/tables/finding_tables.txt b/test/acceptance/keywords/tables/finding_tables.robot similarity index 100% rename from test/acceptance/keywords/tables/finding_tables.txt rename to test/acceptance/keywords/tables/finding_tables.robot diff --git a/test/acceptance/keywords/tables/footer_should_contain.txt b/test/acceptance/keywords/tables/footer_should_contain.robot similarity index 100% rename from test/acceptance/keywords/tables/footer_should_contain.txt rename to test/acceptance/keywords/tables/footer_should_contain.robot diff --git a/test/acceptance/keywords/tables/get_table_cell.txt b/test/acceptance/keywords/tables/get_table_cell.robot similarity index 100% rename from test/acceptance/keywords/tables/get_table_cell.txt rename to test/acceptance/keywords/tables/get_table_cell.robot diff --git a/test/acceptance/keywords/tables/header_should_contain.txt b/test/acceptance/keywords/tables/header_should_contain.robot similarity index 100% rename from test/acceptance/keywords/tables/header_should_contain.txt rename to test/acceptance/keywords/tables/header_should_contain.robot diff --git a/test/acceptance/keywords/tables/negative_indexes.txt b/test/acceptance/keywords/tables/negative_indexes.robot similarity index 100% rename from test/acceptance/keywords/tables/negative_indexes.txt rename to test/acceptance/keywords/tables/negative_indexes.robot diff --git a/test/acceptance/keywords/tables/row_should_contain.txt b/test/acceptance/keywords/tables/row_should_contain.robot similarity index 100% rename from test/acceptance/keywords/tables/row_should_contain.txt rename to test/acceptance/keywords/tables/row_should_contain.robot diff --git a/test/acceptance/keywords/tables/table_resource.txt b/test/acceptance/keywords/tables/table_resource.robot similarity index 100% rename from test/acceptance/keywords/tables/table_resource.txt rename to test/acceptance/keywords/tables/table_resource.robot diff --git a/test/acceptance/keywords/tables/table_should_contain.txt b/test/acceptance/keywords/tables/table_should_contain.robot similarity index 100% rename from test/acceptance/keywords/tables/table_should_contain.txt rename to test/acceptance/keywords/tables/table_should_contain.robot diff --git a/test/acceptance/keywords/textfields.txt b/test/acceptance/keywords/textfields.robot similarity index 100% rename from test/acceptance/keywords/textfields.txt rename to test/acceptance/keywords/textfields.robot diff --git a/test/acceptance/keywords/waiting.txt b/test/acceptance/keywords/waiting.robot similarity index 100% rename from test/acceptance/keywords/waiting.txt rename to test/acceptance/keywords/waiting.robot diff --git a/test/acceptance/locators/__init__.txt b/test/acceptance/locators/__init__.robot similarity index 100% rename from test/acceptance/locators/__init__.txt rename to test/acceptance/locators/__init__.robot diff --git a/test/acceptance/locators/custom.txt b/test/acceptance/locators/custom.robot similarity index 100% rename from test/acceptance/locators/custom.txt rename to test/acceptance/locators/custom.robot diff --git a/test/acceptance/locators/sizzle.txt b/test/acceptance/locators/sizzle.robot similarity index 100% rename from test/acceptance/locators/sizzle.txt rename to test/acceptance/locators/sizzle.robot diff --git a/test/acceptance/multiple_browsers.txt b/test/acceptance/multiple_browsers.robot similarity index 100% rename from test/acceptance/multiple_browsers.txt rename to test/acceptance/multiple_browsers.robot diff --git a/test/acceptance/open_and_close.txt b/test/acceptance/open_and_close.robot similarity index 100% rename from test/acceptance/open_and_close.txt rename to test/acceptance/open_and_close.robot diff --git a/test/acceptance/resource.txt b/test/acceptance/resource.robot similarity index 100% rename from test/acceptance/resource.txt rename to test/acceptance/resource.robot diff --git a/test/acceptance/windows.txt b/test/acceptance/windows.robot similarity index 100% rename from test/acceptance/windows.txt rename to test/acceptance/windows.robot From 9d820eafff9770ba33830485dcdfa2e256928e38 Mon Sep 17 00:00:00 2001 From: zephraph Date: Thu, 25 Jun 2015 16:57:03 -0500 Subject: [PATCH 10/15] Renamed references to resource.txt to resource.robot --- test/acceptance/__init__.robot | 2 +- test/acceptance/create_webdriver.robot | 2 +- test/acceptance/keywords/__init__.robot | 2 +- test/acceptance/keywords/async_javascript.robot | 2 +- test/acceptance/keywords/checkbox_and_radio_buttons.robot | 2 +- test/acceptance/keywords/click_element.robot | 2 +- test/acceptance/keywords/click_element_at_coordinates.robot | 2 +- test/acceptance/keywords/content_assertions.robot | 2 +- test/acceptance/keywords/cookies.robot | 2 +- .../keywords/element_should_be_enabled_and_disabled.robot | 2 +- test/acceptance/keywords/elements.robot | 2 +- test/acceptance/keywords/forms_and_buttons.robot | 2 +- test/acceptance/keywords/frames.robot | 2 +- test/acceptance/keywords/javascript.robot | 2 +- test/acceptance/keywords/lists.robot | 2 +- test/acceptance/keywords/mouse.robot | 2 +- test/acceptance/keywords/navigation.robot | 2 +- test/acceptance/keywords/run_on_failure.robot | 2 +- test/acceptance/keywords/screenshots.robot | 2 +- test/acceptance/keywords/tables/__init__.robot | 2 +- test/acceptance/keywords/tables/col_should_contain.robot | 2 +- test/acceptance/keywords/tables/finding_tables.robot | 2 +- test/acceptance/keywords/tables/footer_should_contain.robot | 2 +- test/acceptance/keywords/tables/get_table_cell.robot | 2 +- test/acceptance/keywords/tables/header_should_contain.robot | 2 +- test/acceptance/keywords/tables/negative_indexes.robot | 2 +- test/acceptance/keywords/tables/row_should_contain.robot | 2 +- test/acceptance/keywords/tables/table_resource.robot | 2 +- test/acceptance/keywords/tables/table_should_contain.robot | 2 +- test/acceptance/keywords/textfields.robot | 2 +- test/acceptance/keywords/waiting.robot | 2 +- test/acceptance/locators/__init__.robot | 2 +- test/acceptance/locators/custom.robot | 2 +- test/acceptance/locators/sizzle.robot | 2 +- test/acceptance/multiple_browsers.robot | 2 +- test/acceptance/open_and_close.robot | 2 +- test/acceptance/windows.robot | 2 +- 37 files changed, 37 insertions(+), 37 deletions(-) diff --git a/test/acceptance/__init__.robot b/test/acceptance/__init__.robot index 3299bcac4..632c26b08 100644 --- a/test/acceptance/__init__.robot +++ b/test/acceptance/__init__.robot @@ -1,5 +1,5 @@ *** Setting *** -Resource resource.txt +Resource resource.robot Force Tags Regression *** Variables *** diff --git a/test/acceptance/create_webdriver.robot b/test/acceptance/create_webdriver.robot index af334cec8..4bfff3db8 100644 --- a/test/acceptance/create_webdriver.robot +++ b/test/acceptance/create_webdriver.robot @@ -1,5 +1,5 @@ *Setting* -Resource resource.txt +Resource resource.robot Library Collections *Test Cases* diff --git a/test/acceptance/keywords/__init__.robot b/test/acceptance/keywords/__init__.robot index 39825bb14..032a95bbe 100644 --- a/test/acceptance/keywords/__init__.robot +++ b/test/acceptance/keywords/__init__.robot @@ -1,4 +1,4 @@ *Setting* -Resource ../resource.txt +Resource ../resource.robot Suite Setup Open Browser To Start Page Suite Teardown Close All Browsers diff --git a/test/acceptance/keywords/async_javascript.robot b/test/acceptance/keywords/async_javascript.robot index 148a05065..45e54774d 100644 --- a/test/acceptance/keywords/async_javascript.robot +++ b/test/acceptance/keywords/async_javascript.robot @@ -1,7 +1,7 @@ *** Settings *** Test Setup Go To Page "javascript/dynamic_content.html" Suite Teardown Set Selenium Timeout 5 seconds -Resource ../resource.txt +Resource ../resource.robot *** Test Cases *** Should Not Timeout If Callback Invoked Immediately diff --git a/test/acceptance/keywords/checkbox_and_radio_buttons.robot b/test/acceptance/keywords/checkbox_and_radio_buttons.robot index 733d6379c..6acb63ffc 100644 --- a/test/acceptance/keywords/checkbox_and_radio_buttons.robot +++ b/test/acceptance/keywords/checkbox_and_radio_buttons.robot @@ -1,6 +1,6 @@ *** Settings *** Test Setup Go To Page "forms/prefilled_email_form.html" -Resource ../resource.txt +Resource ../resource.robot *** Test Cases *** Checkbox Should Be Selected diff --git a/test/acceptance/keywords/click_element.robot b/test/acceptance/keywords/click_element.robot index 7f7aa60b2..4c446da17 100644 --- a/test/acceptance/keywords/click_element.robot +++ b/test/acceptance/keywords/click_element.robot @@ -1,7 +1,7 @@ *** Settings *** Suite Setup Go To Page "javascript/click.html" Test Setup Initialize Page -Resource ../resource.txt +Resource ../resource.robot *** Test Cases *** Click Element diff --git a/test/acceptance/keywords/click_element_at_coordinates.robot b/test/acceptance/keywords/click_element_at_coordinates.robot index 853159557..902f4584c 100644 --- a/test/acceptance/keywords/click_element_at_coordinates.robot +++ b/test/acceptance/keywords/click_element_at_coordinates.robot @@ -1,7 +1,7 @@ *** Settings *** Suite Setup Go To Page "javascript/click_at_coordinates.html" Test Setup Initialize Page -Resource ../resource.txt +Resource ../resource.robot *** Test Cases *** Click Element At Coordinates diff --git a/test/acceptance/keywords/content_assertions.robot b/test/acceptance/keywords/content_assertions.robot index 26c0e8ffd..392ddc49b 100644 --- a/test/acceptance/keywords/content_assertions.robot +++ b/test/acceptance/keywords/content_assertions.robot @@ -1,7 +1,7 @@ *** Settings *** Test Setup Go To Front Page Default Tags assertions -Resource ../resource.txt +Resource ../resource.robot *** Test Cases *** diff --git a/test/acceptance/keywords/cookies.robot b/test/acceptance/keywords/cookies.robot index c205528e5..e39a64b4c 100644 --- a/test/acceptance/keywords/cookies.robot +++ b/test/acceptance/keywords/cookies.robot @@ -2,7 +2,7 @@ Suite Setup Go To Page "cookies.html" Suite Teardown Delete All Cookies Test Setup Add Cookies -Resource ../resource.txt +Resource ../resource.robot *** Test Cases *** Get Cookies diff --git a/test/acceptance/keywords/element_should_be_enabled_and_disabled.robot b/test/acceptance/keywords/element_should_be_enabled_and_disabled.robot index 55c387fcb..b3f22830d 100644 --- a/test/acceptance/keywords/element_should_be_enabled_and_disabled.robot +++ b/test/acceptance/keywords/element_should_be_enabled_and_disabled.robot @@ -1,6 +1,6 @@ *** Settings *** Test Setup Go To Page "forms/enabled_disabled_fields_form.html" -Resource ../resource.txt +Resource ../resource.robot *** Test Cases *** Input Text diff --git a/test/acceptance/keywords/elements.robot b/test/acceptance/keywords/elements.robot index d488b6a90..4e7c731f1 100644 --- a/test/acceptance/keywords/elements.robot +++ b/test/acceptance/keywords/elements.robot @@ -1,6 +1,6 @@ *** Settings *** Test Setup Go To Page "links.html" -Resource ../resource.txt +Resource ../resource.robot *** Test Cases *** Get Elements diff --git a/test/acceptance/keywords/forms_and_buttons.robot b/test/acceptance/keywords/forms_and_buttons.robot index f615a6d7c..e388e9920 100644 --- a/test/acceptance/keywords/forms_and_buttons.robot +++ b/test/acceptance/keywords/forms_and_buttons.robot @@ -1,6 +1,6 @@ *** Settings *** Test Setup Go To Page "forms/named_submit_buttons.html" -Resource ../resource.txt +Resource ../resource.robot Library OperatingSystem diff --git a/test/acceptance/keywords/frames.robot b/test/acceptance/keywords/frames.robot index 4c557b5f7..08c832f7a 100644 --- a/test/acceptance/keywords/frames.robot +++ b/test/acceptance/keywords/frames.robot @@ -1,5 +1,5 @@ *Setting* -Resource ../resource.txt +Resource ../resource.robot Test Setup Go To Page "frames/frameset.html" Test Teardown UnSelect Frame diff --git a/test/acceptance/keywords/javascript.robot b/test/acceptance/keywords/javascript.robot index a0f621a20..e5df21b91 100644 --- a/test/acceptance/keywords/javascript.robot +++ b/test/acceptance/keywords/javascript.robot @@ -1,6 +1,6 @@ *** Settings *** Test Setup Go To Page "javascript/dynamic_content.html" -Resource ../resource.txt +Resource ../resource.robot *** Test Cases *** Clicking Elements Should Activate Javascript diff --git a/test/acceptance/keywords/lists.robot b/test/acceptance/keywords/lists.robot index 562a2c3d9..3b0188947 100644 --- a/test/acceptance/keywords/lists.robot +++ b/test/acceptance/keywords/lists.robot @@ -1,6 +1,6 @@ *** Settings *** Test Setup Go To Page "forms/prefilled_email_form.html" -Resource ../resource.txt +Resource ../resource.robot *** Test Cases *** Get List Items From Single-Select List diff --git a/test/acceptance/keywords/mouse.robot b/test/acceptance/keywords/mouse.robot index 5a5b36e59..536778484 100644 --- a/test/acceptance/keywords/mouse.robot +++ b/test/acceptance/keywords/mouse.robot @@ -1,6 +1,6 @@ *** Settings *** Test Setup Go To Page "mouse/index.html" -Resource ../resource.txt +Resource ../resource.robot *** Test Cases *** Mouse Over diff --git a/test/acceptance/keywords/navigation.robot b/test/acceptance/keywords/navigation.robot index 6db887d88..b7c644e9d 100644 --- a/test/acceptance/keywords/navigation.robot +++ b/test/acceptance/keywords/navigation.robot @@ -1,6 +1,6 @@ *** Settings *** Test Setup Go To Page "links.html" -Resource ../resource.txt +Resource ../resource.robot *** Variables *** ${LINKS TITLE} (root)/links.html diff --git a/test/acceptance/keywords/run_on_failure.robot b/test/acceptance/keywords/run_on_failure.robot index 6d9e45927..beecef48a 100755 --- a/test/acceptance/keywords/run_on_failure.robot +++ b/test/acceptance/keywords/run_on_failure.robot @@ -1,7 +1,7 @@ *** Settings *** Suite Setup Run Keywords Go To Front Page Set Info Loglevel Suite Teardown Set Debug Loglevel -Resource ../resource.txt +Resource ../resource.robot *** Variables *** ${PAGE TITLE} (root)/index.html diff --git a/test/acceptance/keywords/screenshots.robot b/test/acceptance/keywords/screenshots.robot index e86a28327..0d5eddd56 100644 --- a/test/acceptance/keywords/screenshots.robot +++ b/test/acceptance/keywords/screenshots.robot @@ -1,5 +1,5 @@ *** Settings *** -Resource ../resource.txt +Resource ../resource.robot Suite Setup Go To Page "links.html" diff --git a/test/acceptance/keywords/tables/__init__.robot b/test/acceptance/keywords/tables/__init__.robot index 9d1476239..519785de3 100644 --- a/test/acceptance/keywords/tables/__init__.robot +++ b/test/acceptance/keywords/tables/__init__.robot @@ -1,4 +1,4 @@ *** Settings *** -Resource table_resource.txt +Resource table_resource.robot Suite Setup Go To Page "tables/tables.html" diff --git a/test/acceptance/keywords/tables/col_should_contain.robot b/test/acceptance/keywords/tables/col_should_contain.robot index 4fc226268..d1641bc8b 100644 --- a/test/acceptance/keywords/tables/col_should_contain.robot +++ b/test/acceptance/keywords/tables/col_should_contain.robot @@ -1,5 +1,5 @@ *** Settings *** -Resource table_resource.txt +Resource table_resource.robot *** Test Cases *** Should Find Text In Specific Column diff --git a/test/acceptance/keywords/tables/finding_tables.robot b/test/acceptance/keywords/tables/finding_tables.robot index 519dfa022..7d6e8b878 100644 --- a/test/acceptance/keywords/tables/finding_tables.robot +++ b/test/acceptance/keywords/tables/finding_tables.robot @@ -1,5 +1,5 @@ *** Settings *** -Resource table_resource.txt +Resource table_resource.robot *** Test Cases *** Should Identify Table By CSS diff --git a/test/acceptance/keywords/tables/footer_should_contain.robot b/test/acceptance/keywords/tables/footer_should_contain.robot index a40309dde..1c235ada1 100644 --- a/test/acceptance/keywords/tables/footer_should_contain.robot +++ b/test/acceptance/keywords/tables/footer_should_contain.robot @@ -1,5 +1,5 @@ *** Settings *** -Resource table_resource.txt +Resource table_resource.robot *** Test Cases *** Should Find Text In Footer diff --git a/test/acceptance/keywords/tables/get_table_cell.robot b/test/acceptance/keywords/tables/get_table_cell.robot index 5521a996b..cbd8320e6 100644 --- a/test/acceptance/keywords/tables/get_table_cell.robot +++ b/test/acceptance/keywords/tables/get_table_cell.robot @@ -1,5 +1,5 @@ *** Settings *** -Resource table_resource.txt +Resource table_resource.robot *** Test Cases *** Should Retrieve Text From Cell diff --git a/test/acceptance/keywords/tables/header_should_contain.robot b/test/acceptance/keywords/tables/header_should_contain.robot index 42243d24b..64d18e7fd 100644 --- a/test/acceptance/keywords/tables/header_should_contain.robot +++ b/test/acceptance/keywords/tables/header_should_contain.robot @@ -1,5 +1,5 @@ *** Settings *** -Resource table_resource.txt +Resource table_resource.robot *** Test Cases *** Should Find Text In Header diff --git a/test/acceptance/keywords/tables/negative_indexes.robot b/test/acceptance/keywords/tables/negative_indexes.robot index 7908d00b0..a942b41f0 100644 --- a/test/acceptance/keywords/tables/negative_indexes.robot +++ b/test/acceptance/keywords/tables/negative_indexes.robot @@ -1,5 +1,5 @@ *** Settings *** -Resource table_resource.txt +Resource table_resource.robot Documentation Tests negative indexes in Robot keywords *** Test Cases *** diff --git a/test/acceptance/keywords/tables/row_should_contain.robot b/test/acceptance/keywords/tables/row_should_contain.robot index 361110346..e55869436 100644 --- a/test/acceptance/keywords/tables/row_should_contain.robot +++ b/test/acceptance/keywords/tables/row_should_contain.robot @@ -1,5 +1,5 @@ *** Settings *** -Resource table_resource.txt +Resource table_resource.robot *** Test Cases *** Should Find Text In Specific Row diff --git a/test/acceptance/keywords/tables/table_resource.robot b/test/acceptance/keywords/tables/table_resource.robot index 2a336cfba..09a418e9f 100644 --- a/test/acceptance/keywords/tables/table_resource.robot +++ b/test/acceptance/keywords/tables/table_resource.robot @@ -1,5 +1,5 @@ *** Settings *** -Resource ../../resource.txt +Resource ../../resource.robot *** Keywords *** Run Table Keyword With CSS And XPath Locators diff --git a/test/acceptance/keywords/tables/table_should_contain.robot b/test/acceptance/keywords/tables/table_should_contain.robot index 39d9cfafd..1e7f64fa7 100644 --- a/test/acceptance/keywords/tables/table_should_contain.robot +++ b/test/acceptance/keywords/tables/table_should_contain.robot @@ -1,5 +1,5 @@ *** Settings *** -Resource table_resource.txt +Resource table_resource.robot *** Test Cases *** Should Find Text In Table Content diff --git a/test/acceptance/keywords/textfields.robot b/test/acceptance/keywords/textfields.robot index 8344f0efb..6e0f82c6a 100644 --- a/test/acceptance/keywords/textfields.robot +++ b/test/acceptance/keywords/textfields.robot @@ -1,6 +1,6 @@ *Setting* Variables variables.py -Resource ../resource.txt +Resource ../resource.robot Test Setup Go To Page "forms/prefilled_email_form.html" diff --git a/test/acceptance/keywords/waiting.robot b/test/acceptance/keywords/waiting.robot index 8dc7bcbcb..1cac96a3e 100644 --- a/test/acceptance/keywords/waiting.robot +++ b/test/acceptance/keywords/waiting.robot @@ -1,6 +1,6 @@ *** Settings *** Test Setup Go To Page "javascript/delayed_events.html" -Resource ../resource.txt +Resource ../resource.robot *** Test Cases *** Wait For Condition diff --git a/test/acceptance/locators/__init__.robot b/test/acceptance/locators/__init__.robot index f646bf9c8..c5aebb57d 100644 --- a/test/acceptance/locators/__init__.robot +++ b/test/acceptance/locators/__init__.robot @@ -1,4 +1,4 @@ *** Settings *** Suite Setup Open Browser To Start Page Suite Teardown Close All Browsers -Resource ../resource.txt +Resource ../resource.robot diff --git a/test/acceptance/locators/custom.robot b/test/acceptance/locators/custom.robot index 4dffb8a3a..e02d1d3fd 100644 --- a/test/acceptance/locators/custom.robot +++ b/test/acceptance/locators/custom.robot @@ -1,6 +1,6 @@ *** Settings *** Suite Setup Go To Page "index.html" -Resource ../resource.txt +Resource ../resource.robot *** Keywords *** Setup Custom Locator diff --git a/test/acceptance/locators/sizzle.robot b/test/acceptance/locators/sizzle.robot index 9e15dfbb7..926893999 100644 --- a/test/acceptance/locators/sizzle.robot +++ b/test/acceptance/locators/sizzle.robot @@ -1,6 +1,6 @@ *** Settings *** Test Setup Go To Page "jquery.html" -Resource ../resource.txt +Resource ../resource.robot *** Test Cases *** Find By Id diff --git a/test/acceptance/multiple_browsers.robot b/test/acceptance/multiple_browsers.robot index cc001cbb0..a60dfbb46 100644 --- a/test/acceptance/multiple_browsers.robot +++ b/test/acceptance/multiple_browsers.robot @@ -1,7 +1,7 @@ *** Settings *** Suite Setup Open Two Browsers And Register Indexes Suite Teardown Close All Browsers -Resource resource.txt +Resource resource.robot *** Test Cases *** Last Opened Browser Should Be Active diff --git a/test/acceptance/open_and_close.robot b/test/acceptance/open_and_close.robot index b77e17bc2..282c96c26 100644 --- a/test/acceptance/open_and_close.robot +++ b/test/acceptance/open_and_close.robot @@ -1,5 +1,5 @@ *** Settings *** -Resource resource.txt +Resource resource.robot Suite Teardown Close All Browsers *** Test Cases *** diff --git a/test/acceptance/windows.robot b/test/acceptance/windows.robot index d76a8e8b5..59f81ffd6 100644 --- a/test/acceptance/windows.robot +++ b/test/acceptance/windows.robot @@ -5,7 +5,7 @@ Documentation These tests must open own browser because windows opened by Suite Setup Open Browser To Start Page Without Testing Default Options Test Setup Go To Page "javascript/popupwindow.html" Suite Teardown Close All Browsers -Resource resource.txt +Resource resource.robot *Test Cases* Popup Windows Created With Javascript From ae167b5e4df327bd1bdcc2cdea5dfed39ba68032 Mon Sep 17 00:00:00 2001 From: zephraph Date: Thu, 2 Jul 2015 15:02:51 -0500 Subject: [PATCH 11/15] Fixed an invalid attribute reference --- src/Selenium2Library/locators/customlocator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Selenium2Library/locators/customlocator.py b/src/Selenium2Library/locators/customlocator.py index 875b945a9..f1b3b8a1f 100644 --- a/src/Selenium2Library/locators/customlocator.py +++ b/src/Selenium2Library/locators/customlocator.py @@ -12,11 +12,13 @@ def __init__(self, name, finder): self.finder = finder def find(self, *args): + print 'finder', self.finder + print 'name', self.name # Allow custom locators to be keywords or normal methods if isinstance(self.finder, string_type): element = BuiltIn().run_keyword(self.finder, *args) - elif hasattr(self.finder, '__caller__'): + elif hasattr(self.finder, '__call__'): element = self.finder(*args) else: raise AttributeError('Invalid type provided for Custom Locator %s' % self.name) From 205b51649031219095975b60be5f7333ce425f58 Mon Sep 17 00:00:00 2001 From: zephraph Date: Thu, 2 Jul 2015 15:06:58 -0500 Subject: [PATCH 12/15] Update changelog --- CHANGES.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 974af79a9..36dab2508 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,14 @@ Release Notes ============= +1.7.2 +---------------- +- Fixed an error where regular functions were not able to be used as a custom locator + [zephraph] + +- Changed all test files to have a '.robot' extension + [zephraph] + 1.7.1 (hotfix) ---------------- - Remove references to GLOBAL_VARIABLES for RF 2.9 compatibility From 0d5642d80f0768e232677a501449d4b8a7afd7ef Mon Sep 17 00:00:00 2001 From: zephraph Date: Thu, 2 Jul 2015 15:15:24 -0500 Subject: [PATCH 13/15] Remove debug statements --- src/Selenium2Library/locators/customlocator.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Selenium2Library/locators/customlocator.py b/src/Selenium2Library/locators/customlocator.py index f1b3b8a1f..c7f091c39 100644 --- a/src/Selenium2Library/locators/customlocator.py +++ b/src/Selenium2Library/locators/customlocator.py @@ -12,8 +12,6 @@ def __init__(self, name, finder): self.finder = finder def find(self, *args): - print 'finder', self.finder - print 'name', self.name # Allow custom locators to be keywords or normal methods if isinstance(self.finder, string_type): From ee3f9403807f2e065ee77a872fbe77ef67d0759e Mon Sep 17 00:00:00 2001 From: frishberg Date: Thu, 16 Jul 2015 16:43:46 -0400 Subject: [PATCH 14/15] Removing unused import I was looking at this file and noticed an unused import. --- src/Selenium2Library/keywords/_screenshot.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Selenium2Library/keywords/_screenshot.py b/src/Selenium2Library/keywords/_screenshot.py index 5193335db..2b493a108 100644 --- a/src/Selenium2Library/keywords/_screenshot.py +++ b/src/Selenium2Library/keywords/_screenshot.py @@ -1,7 +1,6 @@ import os, errno import robot from keywordgroup import KeywordGroup -from robot.api import logger class _ScreenshotKeywords(KeywordGroup): From f6934fa40db31f984f3c91055fe290dbccb611f6 Mon Sep 17 00:00:00 2001 From: frishberg Date: Thu, 16 Jul 2015 16:45:46 -0400 Subject: [PATCH 15/15] Removing unused import Another unused import here. --- src/Selenium2Library/keywords/_tableelement.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Selenium2Library/keywords/_tableelement.py b/src/Selenium2Library/keywords/_tableelement.py index 330790d30..55eea39c8 100644 --- a/src/Selenium2Library/keywords/_tableelement.py +++ b/src/Selenium2Library/keywords/_tableelement.py @@ -1,6 +1,5 @@ import os import sys -from robot.api import logger from Selenium2Library.locators import TableElementFinder from keywordgroup import KeywordGroup