From 2d35cd23ef7690798767fd4c1f88b4da7a0724e3 Mon Sep 17 00:00:00 2001 From: Gaurang033 Date: Wed, 9 Mar 2016 00:32:56 +0530 Subject: [PATCH 1/4] Added following keywords and their acceptance test cases to fix the issue #463 table_cell_should_not_contain table_column_should_not_contain table_footer_should_not_contain table_header_should_not_contain table_row_should_not_contain table_should_not_contain --- .../keywords/_tableelement.py | 127 ++++++++++++++++++ .../tables/table_should_not_contain.robot | 111 +++++++++++++++ 2 files changed, 238 insertions(+) create mode 100644 test/acceptance/keywords/tables/table_should_not_contain.robot diff --git a/src/Selenium2Library/keywords/_tableelement.py b/src/Selenium2Library/keywords/_tableelement.py index 0c7b03519..89b15e6ac 100644 --- a/src/Selenium2Library/keywords/_tableelement.py +++ b/src/Selenium2Library/keywords/_tableelement.py @@ -73,6 +73,37 @@ def table_cell_should_contain(self, table_locator, row, column, expected, loglev self.log_source(loglevel) raise AssertionError(message) + def table_cell_should_not_contain(self, table_locator, row, column, expected, loglevel='INFO'): + """ + Verifies that a certain cell in a table does not contain `expected`. + + Row and column number start from 1. This keyword passes if the + specified cell does not contain the given content. If you want + to test that the cell content does not match exactly, or that + it e.g. starts with some text, use `Get Table Cell` keyword in + combination with built-in keywords such as `Should Not Be Equal` + or `Should Not Start With`. + + 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 " + "should not have contained text '%s'." + % (table_locator, row, column, expected)) + try: + content = self.get_table_cell(table_locator, row, column, loglevel='NONE') + except AssertionError, err: + self._info(err) + self.log_source(loglevel) + raise AssertionError(message) + self._info("Cell contains %s." % content) + + if expected in content: + self.log_source(loglevel) + raise AssertionError(message) + def table_column_should_contain(self, table_locator, col, expected, loglevel='INFO'): """Verifies that a specific column contains `expected`. @@ -100,6 +131,33 @@ def table_column_should_contain(self, table_locator, col, expected, loglevel='IN "should have contained text '%s'." % (col, table_locator, expected)) + def table_column_should_not_contain(self, table_locator, col, expected, loglevel='INFO'): + """Verifies that a specific column does not contain `expected`. + + 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, + if in one row columns A and B are merged with colspan="2", and + the logical third column contains "C". + + Example: + | Table Column Should Not Contain | tableId | 3 | C | + | Table Column Should Not Contain | tableId | 2 | C | + + To understand how tables are identified, please take a look at + the `introduction`. + + See `Page Should Contain Element` for explanation about + `loglevel` argument. + """ + element = self._table_element_finder.find_by_col(self._current_browser(), table_locator, col, expected) + if element is not None: + self.log_source(loglevel) + raise AssertionError("Column #%s in table identified by '%s' " + "should not have contained text '%s'." + % (col, table_locator, expected)) + def table_footer_should_contain(self, table_locator, expected, loglevel='INFO'): """Verifies that the table footer contains `expected`. @@ -116,6 +174,22 @@ def table_footer_should_contain(self, table_locator, expected, loglevel='INFO'): raise AssertionError("Footer in table identified by '%s' should have contained " "text '%s'." % (table_locator, expected)) + def table_footer_should_not_contain(self, table_locator, expected, loglevel='INFO'): + """Verifies that the table footer does not contain `expected`. + + With table footer can be described as any -element that is + child of a -element. To understand how tables are + identified, please take a look at the `introduction`. + + See `Page Should Contain Element` for explanation about + `loglevel` argument. + """ + element = self._table_element_finder.find_by_footer(self._current_browser(), table_locator, expected) + if element is not None: + self.log_source(loglevel) + raise AssertionError("Footer in table identified by '%s' should not have contained " + "text '%s'." % (table_locator, expected)) + def table_header_should_contain(self, table_locator, expected, loglevel='INFO'): """Verifies that the table header, i.e. any ... element, contains `expected`. @@ -131,6 +205,21 @@ def table_header_should_contain(self, table_locator, expected, loglevel='INFO'): raise AssertionError("Header in table identified by '%s' should have contained " "text '%s'." % (table_locator, expected)) + def table_header_should_not_contain(self, table_locator, expected, loglevel='INFO'): + """Verifies that the table header, i.e. any ... element, does not contain `expected`. + + To understand how tables are identified, please take a look at + the `introduction`. + + See `Page Should Contain Element` for explanation about + `loglevel` argument. + """ + element = self._table_element_finder.find_by_header(self._current_browser(), table_locator, expected) + if element is not None: + self.log_source(loglevel) + raise AssertionError("Header in table identified by '%s' should not have contained " + "text '%s'." % (table_locator, expected)) + def table_row_should_contain(self, table_locator, row, expected, loglevel='INFO'): """Verifies that a specific table row contains `expected`. @@ -154,6 +243,29 @@ def table_row_should_contain(self, table_locator, row, expected, loglevel='INFO' raise AssertionError("Row #%s in table identified by '%s' should have contained " "text '%s'." % (row, table_locator, expected)) + def table_row_should_not_contain(self, table_locator, row, expected, loglevel='INFO'): + """Verifies that a specific table row does not contain `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` + or `Table Footer Should Contain` for tests against the header or + footer content. + + If the table contains cells that span multiple rows, a match + only occurs for the uppermost row of those merged cells. To + understand how tables are identified, please take a look at + the `introduction`. + + See `Page Should Contain Element` for explanation about `loglevel` argument. + """ + element = self._table_element_finder.find_by_row(self._current_browser(), table_locator, row, expected) + if element is not None: + self.log_source(loglevel) + raise AssertionError("Row #%s in table identified by '%s' should have contained " + "text '%s'." % (row, table_locator, expected)) + def table_should_contain(self, table_locator, expected, loglevel='INFO'): """Verifies that `expected` can be found somewhere in the table. @@ -168,3 +280,18 @@ def table_should_contain(self, table_locator, expected, loglevel='INFO'): self.log_source(loglevel) raise AssertionError("Table identified by '%s' should have contained text '%s'." \ % (table_locator, expected)) + + def table_should_not_contain(self, table_locator, expected, loglevel='INFO'): + """Verifies that `expected` should not be present anywhere in the table. + + To understand how tables are identified, please take a look at + the `introduction`. + + See `Page Should Contain Element` for explanation about + `loglevel` argument. + """ + element = self._table_element_finder.find_by_content(self._current_browser(), table_locator, expected) + if element is not None: + self.log_source(loglevel) + raise AssertionError("Table identified by '%s' should not have contained text '%s'." \ + % (table_locator, expected)) diff --git a/test/acceptance/keywords/tables/table_should_not_contain.robot b/test/acceptance/keywords/tables/table_should_not_contain.robot new file mode 100644 index 000000000..fec4a0081 --- /dev/null +++ b/test/acceptance/keywords/tables/table_should_not_contain.robot @@ -0,0 +1,111 @@ +*** Settings *** +Documentation Tests table contents for should not keyowrds +Resource table_resource.robot +Default Tags table_not_contain + + +*** Test Cases *** +Should Give Error Message When Content Found In Table + [Documentation] Should Give Error Message When Content Found In Table + [Template] Verify Table Does Contain With CSS And XPath Locators + simpleTable simpleTable_A1 + simpleTable simpleTable_C3 + simpleWithNested simpleWithNested_A1 + simpleWithNested nestedTable_A1 + nestedTable nestedTable_A1 + nestedTable nestedTable_C3 + tableWithSingleHeader tableWithSingleHeader_B1 + tableWithSingleHeader tableWithSingleHeader_B2 + withHeadAndFoot withHeadAndFoot_AH1 + withHeadAndFoot withHeadAndFoot_B2 + withHeadAndFoot withHeadAndFoot_CF1 + mergedRows mergedRows_A1 + mergedCols mergedCols_B2 + formattedTable formattedTable_A1 + formattedTable formattedTable_B1 + formattedTable formattedTable_C1 + formattedTable formattedTable_A2 + formattedTable formattedTable_B2 + formattedTable formattedTable_ÄÖÜäöüß + formattedTable äöü€&äöü€& + +Test Table Cell Should Not Contain + [Documentation] Test Table Cell Should Not Contain + ${table}= set variable simpleTable + ${row}= set variable 1 + ${col}= set variable 1 + ${expected} = set variable simpleTable_A2 + table cell should not contain ${table} ${row} ${col} ${expected} + +Test Table Cell Give Error When It Contains + [Documentation] Test Table Cell Give Error When It Contains + ${table}= set variable simpleTable + ${row}= set variable 1 + ${col}= set variable 1 + ${expected} = set variable simpleTable_A1 + ${err}= Set Variable Cell in table '${table}' in row #${row} and column #${col} should not have contained text '${expected}'. + Run Keyword And Expect Error ${err} table cell should not contain ${table} ${row} ${col} ${expected} + +Test Table Row Should Not Contain + [Documentation] Test Table Row Should Not Contain + ${table}= set variable simpleTable + ${row}= set variable 1 + ${expected} = set variable simpleTable_A2 + table row should not contain ${table} ${row} ${expected} + +Test Table Row Should Give Error When It Contains + [Documentation] Test Table Row Should Give Error When It Contains + ${table}= set variable tableWithSingleHeader + ${expected} = set variable tableWithSingleHeader_A1 + ${row}= set variable 1 + ${err}= Set Variable Row #${row} in table identified by '${table}' should have contained text '${expected}'. + run keyword and expect error ${err} table row should not contain ${table} ${row} ${expected} + +Test Table column Should Not Contain + [Documentation] Test Table column Should Not Contain + ${table}= set variable simpleTable + ${column}= set variable 1 + ${expected} = set variable simpleTable_B2 + table column should not contain ${table} ${column} ${expected} + +Test Table column Should Give Error When It Contains + [Documentation] Test Table column Should Give Error When It Contains + ${table}= set variable tableWithSingleHeader + ${column}= set variable 1 + ${expected} = set variable tableWithSingleHeader_A1 + ${err}= Set Variable Column #${column} in table identified by '${table}' should not have contained text '${expected}'. + run keyword and expect error ${err} table column should not contain ${table} ${column} ${expected} + +Test Table Header Should Not Contain + [Documentation] Test Table Header Should Not Contain + ${table}= set variable tableWithSingleHeader + ${expected} = set variable tableWithSingleHeader_A3 + table header should not contain ${table} ${expected} + +Test Table Header Should Give Error When It Contains + [Documentation] Test Table Header Should Give Error When It Contains + ${table}= set variable tableWithSingleHeader + ${expected} = set variable tableWithSingleHeader_A1 + ${err}= Set Variable Header in table identified by '${table}' should not have contained text '${expected}'. + run keyword and expect error ${err} table header should not contain ${table} ${expected} + +Test Table Footer Should Not Contain + [Documentation] Test Table Footer Should Not Contain + ${table}= set variable withHeadAndFoot + ${expected} = set variable withHeadAndFoot_A1 + table footer should not contain ${table} ${expected} + +Test Table Footer Should Give Error When It Contains + [Documentation] Test Table Footer Should Give Error When It Contains + ${table}= set variable withHeadAndFoot + ${expected} = set variable withHeadAndFoot_AF1 + ${err}= Set Variable Footer in table identified by '${table}' should not have contained text '${expected}'. + run keyword and expect error ${err} table footer should not contain ${table} ${expected} + + +*** Keywords *** +Verify Table Does Contain With CSS And XPath Locators + [Arguments] ${locator} ${expected} + [Documentation] Verify Table Contains With CSS And XPath Locators + ${err}= Set Variable Table identified by '${locator}' should not have contained text '${expected}'. + Run Keyword And Expect Error ${err} Table Should Not Contain ${locator} ${expected} From d9880bb3b0451669be5f1942e3445ef7912d55c8 Mon Sep 17 00:00:00 2001 From: Gaurang Shah Date: Thu, 5 Jan 2017 12:23:31 +0100 Subject: [PATCH 2/4] incorporated the code review comments --- .../keywords/_tableelement.py | 68 +++++++++---------- .../tables/table_should_not_contain.robot | 61 ++++++++++------- 2 files changed, 69 insertions(+), 60 deletions(-) diff --git a/src/Selenium2Library/keywords/_tableelement.py b/src/Selenium2Library/keywords/_tableelement.py index 89b15e6ac..4f8a6bd4a 100644 --- a/src/Selenium2Library/keywords/_tableelement.py +++ b/src/Selenium2Library/keywords/_tableelement.py @@ -73,7 +73,7 @@ def table_cell_should_contain(self, table_locator, row, column, expected, loglev self.log_source(loglevel) raise AssertionError(message) - def table_cell_should_not_contain(self, table_locator, row, column, expected, loglevel='INFO'): + def table_cell_should_not_contain(self, table_locator, row, column, value, loglevel='INFO'): """ Verifies that a certain cell in a table does not contain `expected`. @@ -89,18 +89,19 @@ def table_cell_should_not_contain(self, table_locator, row, column, expected, lo See `Page Should Contain` for explanation about `loglevel` argument. """ - message = ("Cell in table '%s' in row #%s and column #%s " - "should not have contained text '%s'." - % (table_locator, row, column, expected)) + message = ("Cell in table '%s' in row #%s and column #%s should not have contained text '%s'." + % (table_locator, row, column, value)) + cell_not_exist_message = ("Cell in table '%s' in row #%s and column #%s was not found" + % (table_locator, row, column)) + # TODO new message as per comment try: content = self.get_table_cell(table_locator, row, column, loglevel='NONE') - except AssertionError, err: + except AssertionError as err: self._info(err) self.log_source(loglevel) - raise AssertionError(message) + raise AssertionError(cell_not_exist_message) self._info("Cell contains %s." % content) - - if expected in content: + if value in content: self.log_source(loglevel) raise AssertionError(message) @@ -131,7 +132,7 @@ def table_column_should_contain(self, table_locator, col, expected, loglevel='IN "should have contained text '%s'." % (col, table_locator, expected)) - def table_column_should_not_contain(self, table_locator, col, expected, loglevel='INFO'): + def table_column_should_not_contain(self, table_locator, col, value, loglevel='INFO'): """Verifies that a specific column does not contain `expected`. The first leftmost column is column number 1. A negative column @@ -151,12 +152,11 @@ def table_column_should_not_contain(self, table_locator, col, expected, loglevel See `Page Should Contain Element` for explanation about `loglevel` argument. """ - element = self._table_element_finder.find_by_col(self._current_browser(), table_locator, col, expected) - if element is not None: + element = self._table_element_finder.find_by_col(self._current_browser(), table_locator, col, value) + if element: self.log_source(loglevel) - raise AssertionError("Column #%s in table identified by '%s' " - "should not have contained text '%s'." - % (col, table_locator, expected)) + raise AssertionError("Column #%s in table identified by '%s' should not have contained text '%s'." + % (col, table_locator, value)) def table_footer_should_contain(self, table_locator, expected, loglevel='INFO'): """Verifies that the table footer contains `expected`. @@ -174,7 +174,7 @@ def table_footer_should_contain(self, table_locator, expected, loglevel='INFO'): raise AssertionError("Footer in table identified by '%s' should have contained " "text '%s'." % (table_locator, expected)) - def table_footer_should_not_contain(self, table_locator, expected, loglevel='INFO'): + def table_footer_should_not_contain(self, table_locator, value, loglevel='INFO'): """Verifies that the table footer does not contain `expected`. With table footer can be described as any -element that is @@ -184,11 +184,11 @@ def table_footer_should_not_contain(self, table_locator, expected, loglevel='INF See `Page Should Contain Element` for explanation about `loglevel` argument. """ - element = self._table_element_finder.find_by_footer(self._current_browser(), table_locator, expected) - if element is not None: + element = self._table_element_finder.find_by_footer(self._current_browser(), table_locator, value) + if element: self.log_source(loglevel) - raise AssertionError("Footer in table identified by '%s' should not have contained " - "text '%s'." % (table_locator, expected)) + raise AssertionError("Footer in table identified by '%s' should not have contained text '%s'." + % (table_locator, value)) def table_header_should_contain(self, table_locator, expected, loglevel='INFO'): """Verifies that the table header, i.e. any ... element, contains `expected`. @@ -205,7 +205,7 @@ def table_header_should_contain(self, table_locator, expected, loglevel='INFO'): raise AssertionError("Header in table identified by '%s' should have contained " "text '%s'." % (table_locator, expected)) - def table_header_should_not_contain(self, table_locator, expected, loglevel='INFO'): + def table_header_should_not_contain(self, table_locator, value, loglevel='INFO'): """Verifies that the table header, i.e. any ... element, does not contain `expected`. To understand how tables are identified, please take a look at @@ -214,11 +214,11 @@ def table_header_should_not_contain(self, table_locator, expected, loglevel='INF See `Page Should Contain Element` for explanation about `loglevel` argument. """ - element = self._table_element_finder.find_by_header(self._current_browser(), table_locator, expected) - if element is not None: + element = self._table_element_finder.find_by_header(self._current_browser(), table_locator, value) + if element: self.log_source(loglevel) - raise AssertionError("Header in table identified by '%s' should not have contained " - "text '%s'." % (table_locator, expected)) + raise AssertionError("Header in table identified by '%s' should not have contained text '%s'." + % (table_locator, value)) def table_row_should_contain(self, table_locator, row, expected, loglevel='INFO'): """Verifies that a specific table row contains `expected`. @@ -243,7 +243,7 @@ def table_row_should_contain(self, table_locator, row, expected, loglevel='INFO' raise AssertionError("Row #%s in table identified by '%s' should have contained " "text '%s'." % (row, table_locator, expected)) - def table_row_should_not_contain(self, table_locator, row, expected, loglevel='INFO'): + def table_row_should_not_contain(self, table_locator, row, value, loglevel='INFO'): """Verifies that a specific table row does not contain `expected`. The uppermost row is row number 1. A negative column @@ -260,11 +260,11 @@ def table_row_should_not_contain(self, table_locator, row, expected, loglevel='I See `Page Should Contain Element` for explanation about `loglevel` argument. """ - element = self._table_element_finder.find_by_row(self._current_browser(), table_locator, row, expected) - if element is not None: + element = self._table_element_finder.find_by_row(self._current_browser(), table_locator, row, value) + if element: self.log_source(loglevel) - raise AssertionError("Row #%s in table identified by '%s' should have contained " - "text '%s'." % (row, table_locator, expected)) + raise AssertionError("Row #%s in table identified by '%s' should have contained text '%s'." + % (row, table_locator, value)) def table_should_contain(self, table_locator, expected, loglevel='INFO'): """Verifies that `expected` can be found somewhere in the table. @@ -281,7 +281,7 @@ def table_should_contain(self, table_locator, expected, loglevel='INFO'): raise AssertionError("Table identified by '%s' should have contained text '%s'." \ % (table_locator, expected)) - def table_should_not_contain(self, table_locator, expected, loglevel='INFO'): + def table_should_not_contain(self, table_locator, value, loglevel='INFO'): """Verifies that `expected` should not be present anywhere in the table. To understand how tables are identified, please take a look at @@ -290,8 +290,8 @@ def table_should_not_contain(self, table_locator, expected, loglevel='INFO'): See `Page Should Contain Element` for explanation about `loglevel` argument. """ - element = self._table_element_finder.find_by_content(self._current_browser(), table_locator, expected) - if element is not None: + element = self._table_element_finder.find_by_content(self._current_browser(), table_locator, value) + if element: self.log_source(loglevel) - raise AssertionError("Table identified by '%s' should not have contained text '%s'." \ - % (table_locator, expected)) + raise AssertionError("Table identified by '%s' should not have contained text '%s'." + % (table_locator, value)) diff --git a/test/acceptance/keywords/tables/table_should_not_contain.robot b/test/acceptance/keywords/tables/table_should_not_contain.robot index fec4a0081..528126344 100644 --- a/test/acceptance/keywords/tables/table_should_not_contain.robot +++ b/test/acceptance/keywords/tables/table_should_not_contain.robot @@ -34,60 +34,69 @@ Test Table Cell Should Not Contain ${table}= set variable simpleTable ${row}= set variable 1 ${col}= set variable 1 - ${expected} = set variable simpleTable_A2 - table cell should not contain ${table} ${row} ${col} ${expected} + ${value} = set variable simpleTable_A2 + table cell should not contain ${table} ${row} ${col} ${value} + +Test Table Cell Give Error When Cell Not Present + [Documentation] Test Table Cell Should Not Contain when Cell is not present in the table + ${table}= set variable simpleTable + ${row}= set variable 1 + ${col}= set variable 10 + ${value} = set variable simpleTable_A1 + ${err}= Set Variable Cell in table '${table}' in row #${row} and column #${col} was not found + Run Keyword And Expect Error ${err} table cell should not contain ${table} ${row} ${col} ${value} Test Table Cell Give Error When It Contains [Documentation] Test Table Cell Give Error When It Contains ${table}= set variable simpleTable ${row}= set variable 1 ${col}= set variable 1 - ${expected} = set variable simpleTable_A1 - ${err}= Set Variable Cell in table '${table}' in row #${row} and column #${col} should not have contained text '${expected}'. - Run Keyword And Expect Error ${err} table cell should not contain ${table} ${row} ${col} ${expected} + ${value} = set variable simpleTable_A1 + ${err}= Set Variable Cell in table '${table}' in row #${row} and column #${col} should not have contained text '${value}'. + Run Keyword And Expect Error ${err} table cell should not contain ${table} ${row} ${col} ${value} Test Table Row Should Not Contain [Documentation] Test Table Row Should Not Contain ${table}= set variable simpleTable ${row}= set variable 1 - ${expected} = set variable simpleTable_A2 - table row should not contain ${table} ${row} ${expected} + ${value} = set variable simpleTable_A2 + table row should not contain ${table} ${row} ${value} Test Table Row Should Give Error When It Contains [Documentation] Test Table Row Should Give Error When It Contains ${table}= set variable tableWithSingleHeader - ${expected} = set variable tableWithSingleHeader_A1 + ${value} = set variable tableWithSingleHeader_A1 ${row}= set variable 1 - ${err}= Set Variable Row #${row} in table identified by '${table}' should have contained text '${expected}'. - run keyword and expect error ${err} table row should not contain ${table} ${row} ${expected} + ${err}= Set Variable Row #${row} in table identified by '${table}' should have contained text '${value}'. + run keyword and expect error ${err} table row should not contain ${table} ${row} ${value} Test Table column Should Not Contain [Documentation] Test Table column Should Not Contain ${table}= set variable simpleTable ${column}= set variable 1 - ${expected} = set variable simpleTable_B2 - table column should not contain ${table} ${column} ${expected} + ${value} = set variable simpleTable_B2 + table column should not contain ${table} ${column} ${value} Test Table column Should Give Error When It Contains [Documentation] Test Table column Should Give Error When It Contains ${table}= set variable tableWithSingleHeader ${column}= set variable 1 - ${expected} = set variable tableWithSingleHeader_A1 - ${err}= Set Variable Column #${column} in table identified by '${table}' should not have contained text '${expected}'. - run keyword and expect error ${err} table column should not contain ${table} ${column} ${expected} + ${value} = set variable tableWithSingleHeader_A1 + ${err}= Set Variable Column #${column} in table identified by '${table}' should not have contained text '${value}'. + run keyword and expect error ${err} table column should not contain ${table} ${column} ${value} Test Table Header Should Not Contain [Documentation] Test Table Header Should Not Contain ${table}= set variable tableWithSingleHeader - ${expected} = set variable tableWithSingleHeader_A3 - table header should not contain ${table} ${expected} + ${value} = set variable tableWithSingleHeader_A3 + table header should not contain ${table} ${value} Test Table Header Should Give Error When It Contains [Documentation] Test Table Header Should Give Error When It Contains ${table}= set variable tableWithSingleHeader - ${expected} = set variable tableWithSingleHeader_A1 - ${err}= Set Variable Header in table identified by '${table}' should not have contained text '${expected}'. - run keyword and expect error ${err} table header should not contain ${table} ${expected} + ${value} = set variable tableWithSingleHeader_A1 + ${err}= Set Variable Header in table identified by '${table}' should not have contained text '${value}'. + run keyword and expect error ${err} table header should not contain ${table} ${value} Test Table Footer Should Not Contain [Documentation] Test Table Footer Should Not Contain @@ -98,14 +107,14 @@ Test Table Footer Should Not Contain Test Table Footer Should Give Error When It Contains [Documentation] Test Table Footer Should Give Error When It Contains ${table}= set variable withHeadAndFoot - ${expected} = set variable withHeadAndFoot_AF1 - ${err}= Set Variable Footer in table identified by '${table}' should not have contained text '${expected}'. - run keyword and expect error ${err} table footer should not contain ${table} ${expected} + ${value} = set variable withHeadAndFoot_AF1 + ${err}= Set Variable Footer in table identified by '${table}' should not have contained text '${value}'. + run keyword and expect error ${err} table footer should not contain ${table} ${value} *** Keywords *** Verify Table Does Contain With CSS And XPath Locators - [Arguments] ${locator} ${expected} + [Arguments] ${locator} ${value} [Documentation] Verify Table Contains With CSS And XPath Locators - ${err}= Set Variable Table identified by '${locator}' should not have contained text '${expected}'. - Run Keyword And Expect Error ${err} Table Should Not Contain ${locator} ${expected} + ${err}= Set Variable Table identified by '${locator}' should not have contained text '${value}'. + Run Keyword And Expect Error ${err} Table Should Not Contain ${locator} ${value} From 8d4dfa32173056b57c12abbaa0834b7946f6fb34 Mon Sep 17 00:00:00 2001 From: Gaurang Shah Date: Thu, 5 Jan 2017 13:05:47 +0100 Subject: [PATCH 3/4] updated with new table keywords --- CHANGES.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index bfc6dfbf6..d754d3cab 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,14 @@ Release Notes 1.8.1 ----- - Added 'Get Locations' keyword [thaffenden] +- Added Following Table keywords [Gaurang033] + + - table_cell_should_not_contain + - table_column_should_not_contain + - table_footer_should_not_contain + - table_header_should_not_contain + - table_row_should_not_contain + - table_should_not_contain 1.8.0 ----- From 81fb55ac27aa1efc3eea56f572bc542dd504611c Mon Sep 17 00:00:00 2001 From: Gaurang Shah Date: Sun, 29 Jan 2017 16:29:26 +0100 Subject: [PATCH 4/4] removed the unnecessary TODO statement. --- 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 4f8a6bd4a..de6eb80fb 100644 --- a/src/Selenium2Library/keywords/_tableelement.py +++ b/src/Selenium2Library/keywords/_tableelement.py @@ -93,7 +93,6 @@ def table_cell_should_not_contain(self, table_locator, row, column, value, logle % (table_locator, row, column, value)) cell_not_exist_message = ("Cell in table '%s' in row #%s and column #%s was not found" % (table_locator, row, column)) - # TODO new message as per comment try: content = self.get_table_cell(table_locator, row, column, loglevel='NONE') except AssertionError as err: