Properties file for WebElements

We have explored WebElements to a large extent. Now we will actually start preparing for the hybrid framework (we will look at this in a later chapter) by creating a WebElement store. This store will be created in a file known as the properties file, which always has the .properties extension. An example entry in the properties file can be:

USERNAME=//*[@name='username'] 

Entries in the properties file consist of key value pairs. Here, username is the key and '//*[@name='username'] ' is the value. 

The key in a properties file should always be unique. The value part can have duplicate values.

These values should be retrieved by the code once the key is supplied. For this purpose, we will be writing a retrieval program in a subsequent chapter.

The next question that might come up to mind is: we have created a properties file and will be writing retrieval logic for this, but on what basis should the retrieval logic be invoked? For this purpose, we will have to create test scripts. The test scripts can be created either in an Excel or in a database. We have APIs such as Apache POI and Fillo available as open source. Fillo gives us certain advantages over POI. Fillo treats an Excel tab as a database table and regular SQL queries, such as SELECT, UPDATE, and DELETE, can be triggered on the Excel tab data. Each row is equivalent to the row in a DB table while a column is equivalent to a database field. We will gradually uncover the power of Fillo as we move ahead but the curtain raiser will be in Chapter 3Basic Selenium Commands and Their Usage in Building a Framework. As of the current release of Fillo, joins are not possible but we will not require complex joins for our framework.

Let's take a small diversion here to see what the prerequisites for automating mobile applications are.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.73.35