A data-driven framework in Selenium is an approach to separating a ‘dataset’ from the actual ‘test case’ (code). This framework is completely dependent on the input test data. The test data is inserted from external sources, such as an Excel file, a CSV file, or any database. It also allows us to easily control how much data needs to be tested. We can easily increase the number of test parameters by adding more username and password fields to the Excel file (or other sources).
A keyword-driven framework is an extension of the data-driven testing framework in the sense that it not only isolates the test data from the scripts but also keeps the particular section of the code belonging to the test script in an external data file. These sets of code are known as keywords, and hence the framework is so named. Keywords are self-guiding and work based on what actions need to be performed on the application.