Example code:
*** Settings ***
Library SeleniumLibrary #4.0.0
*** Variables ***
${url} https://www.w3schools.com/html/html_tables.asp
${customer_table} //table[@id='customers']
*** Test Cases ***
Sample test
Open Browser ${url} browser=chrome
Maximize browser window
Element Should Be Visible ${customer_table}
Table Should Contain ${customer_table} Each
Expected behavior and actual behavior
Expected: FAIL
Actual: PASS
If there is given text on the page and even I provide ID of table for this keyword, then this keyword returns True. (table does not contain text)
Table Should Contain is useless in that case because I can also use Page Should Contain to find text on the page. In my project, I have two tables on the page where one record is moved to the second table and I need to verify that.
Environment
Browser: Chrome 77.0.3865.90
Browser driver: ChromeDriver 2.42.591088
Operating System: Windows 10 17763.740
Libraries
- Robot Framework: 3.1.2
- Selenium: 3.141.0
- SeleniumLibrary: 4.0.0
- Interpreter: Python 3.7.4
Example code:
*** Settings ***
Library SeleniumLibrary #4.0.0
*** Variables ***
${url} https://www.w3schools.com/html/html_tables.asp
${customer_table} //table[@id='customers']
*** Test Cases ***
Sample test
Open Browser ${url} browser=chrome
Maximize browser window
Element Should Be Visible ${customer_table}
Table Should Contain ${customer_table} Each
Expected behavior and actual behavior
Expected: FAIL
Actual: PASS
If there is given text on the page and even I provide ID of table for this keyword, then this keyword returns True. (table does not contain text)
Table Should Containis useless in that case because I can also usePage Should Containto find text on the page. In my project, I have two tables on the page where one record is moved to the second table and I need to verify that.Environment
Browser: Chrome 77.0.3865.90
Browser driver: ChromeDriver 2.42.591088
Operating System: Windows 10 17763.740
Libraries