Lists and Tables (No-Code, Script-Less)

In this tutorial, we will create a simple test for searching flights. Take a look at our demo booking page. Here we have three combobox elements, one date picker control and a search button. We will create a special view for of the combobox elements and for the DatePicker control to select the right destination. Let’s start with the “From” control; Click the Scan GUI button. We should scan our view with the combobox opened. To do that, hold the control key on your keyboard and click on the combobox to open it, then release the control key and click anywhere in the application to scan it. Enter the name for the application and for the view. Here we need only one object - the label “From”. We will select this object and remove the rest of the objects. Now we should create a related object which we will use later in the test to perform a click on it to extend the combobox drop down list. To select the item in the combobox list, we can use the ZAPTEST special object type, “List”. List has a special parameter - number of rows. Our combobox list has four rows. All list objects should have a parent object; in our case, it is the label “From”. Let’s add steps to our project. Our test should start from the launching of the browser application. We should open the browser and navigate to webpage. Then we should click on the first combobox to open it and select the departure city. To select it we will use the List object. This object has a special method the ClickRow, which has a text parameter of the item value. In this test, we will use Datatable for all used parameters. Let’s add a new parameter - “From” to our Datatable. Let's choose “New York” as our departure city. Then use this data in the ClickRow method. Let’s run the test! ZAPTEST will now open the booking page and select “New York” in the departure field. We should repeat these same steps for the next combobox control. Click Scan to create a new view and remove all objects except the label “To”. Now create relative objects: one regular for activating the combobox dropdown and another one – “list” – for selecting the item value. This combobox item has three lines, so we should set this number to the “Rows” field. We should also set the relative object for “list” as the label “To”. Let’s return to our test, we should add a new parameter to our Datatable – “destination”, activate our combobox and then select the destination; now we have our destination selected. The next element is DatePicker control. Just like we did before, we should create a new view for the DatePicker control. To make the DatePicker control visible, use the control key trick that we learned earlier and scan the page. Here we should remove all the objects except the “Date” label and then we should create one special object for opening the DatePicker. In this tutorial, we will select just one date. In our next lesson we will show you how to change the month and add some advanced logic to the calendar. For working with calendars ZAPTEST has a special object type, “Table”. The Table object can represent any table and has two parameters; rows and columns. In our case, DatePicker control has seven columns and five rows, and the List object Table should have a parent object; let's set it to the “Date” label. It’s time to add some script steps around the DatePicker control. We will need to open a calendar and select the 28th day of the current month. Let's add a new parameter to our Datatable and set it to 28. When we enter a number, the Datatable will represent it as a numeric format. Each cell has a context menu where we can set different properties. One of these properties is "Format', so we should set the format of the date to "Text" because the method which we will use accepts only text data. Now we can activate the DatePicker by clicking on it. Let's add the table object and use the method ClickCell. The last thing we should do is to click on the search button and collect the results. Let’s create a new view for the results. Scan UI of the web page with the results. Here we should keep the following objects: the "Search" button, the "Search" label for detecting results, and the "Flight" label for collecting information about the flights. Truncate the “Search Results” label; we will use the "OCR Partial" mode to detect only the first part of the string. To do this, open the extended properties panel and change the Recognition Type to "Partial OCR". This will allow us to run universal result checking, which will not be influenced by the date or the flight information. We will also add a new related object for collecting flight numbers. Here we should update a property: the text color, which should be set to white. In the test we will click on the search button and use the Exist method to check the results. Then we will use the GetText method to get text data from the object. This method returns current text data of the object, which we could keep in a variable. Let’s set up If-Else conditional statement to check if search results appear. Then we will collect and save flight number to our report using the CustomReport method, which we already used in the first lesson. We will add Else conditional statement and use Custom Report method to report error The last line of our test should close the browser window. Let’s run the test, ZAPTEST will select the destinations, change the date, click on the search button and then it will save the flight numbers to the report and close the browser. Let’s open the results; here we can see detailed information about all of the steps taken in searching a flight. Thank you for using ZAPTEST

Contact Us

1425 Market Blvd Suite 530-230

Roswell, GA 30076, USA

(800) 795-3552