Using "Functions" Activity
The Functions activity under the Applications component can refresh a page opened in a previous Open activity, check whether a field exists on the page, or find the number of rows in a table on the page.
Case Examples
Case 1: Counting Rows in a Table
Finding how many rows of data are in a table on a page.
With the Functions activity, it is possible to retrieve the number of different currencies listed on the TCMB daily exchange rates page.
Applications – Open – Properties
| Field | Value |
|---|---|
| Application name (Required) | TCMBCurrencies |
| URL (Required) | https://www.tcmb.gov.tr/kurlar/today.xml |
| Type (Required) | Chrome |
| Maximize | ☑ |
Applications – Functions – Properties
| Field | Value |
|---|---|
| Application name (Required) | ${TCMBCurrencies} |
| Field (Required) | //*[@id="kurlarContainer"]/table[1]/tbody/tr[position()>1] |
| Result Variable Name | count |
| Action (Required) | elementcount |
Note: In this example, since the header row is also counted as a row, the XPath must skip the first row using
position()>1. The full XPath is://*[@id="kurlarContainer"]/table[1]/tbody/tr[position()>1]
Case 2: Refreshing a Page
The Functions activity can be used whenever a page opened earlier in the process needs to be refreshed and reloaded.
Set the Action field to refresh and provide the Application name of the previously opened browser session.
Case 3: Checking Whether a Field Exists
The Functions activity can be used to check whether a specific field is present on a page — for example, to detect an error message that appears after an invalid form submission.
In this example, an incomplete form entry is submitted deliberately to verify whether the error message appears. In real processes, the same Gateway pattern can be used to branch logic based on whether a field is found (true) or not (false).
Applications – Open – Properties
| Field | Value |
|---|---|
| Application name (Required) | FunctionsExist |
| URL (Required) | https://uyg.sgk.gov.tr/vizite/welcome.do |
| Type (Required) | Chrome |
| Maximize | ☑ |
Applications – Set Methods – Properties
| Field | Value |
|---|---|
| Application name (Required) | ${FunctionsExist} |
| Field (Required) | //input[@name="kullaniciAdi"] |
| Text (Required) | RobustaAcademy |
| Type (Required) | text |
Applications – Mouse Actions – Properties
| Field | Value |
|---|---|
| Application name (Required) | ${FunctionsExist} |
| Field (Required) | //input[@name="kaydet"] |
| Wait until load | ☑ |
| Wait until visible | ☑ |
Applications – Functions – Properties
| Field | Value |
|---|---|
| Application name (Required) | ${FunctionsExist} |
| Field (Required) | /html/body/table[2]/tbody/tr/td/table[1]/tbody/tr/td[2] |
| Result Variable Name | control |
| Action (Required) | exists |
Arrow – True – Properties
| Field | Value |
|---|---|
| Flow condition | ${control==true} |
| Default Flow | ☐ |
Arrow – False – Properties
| Field | Value |
|---|---|
| Flow condition | (empty) |
| Default Flow | ☑ |