Using “Functions” Activity
The “ Functions ” Activity under the “ Applications ” component can refresh the page in the previously opened “ Open ” Activity check whether a field exists on the page or find the number of rows in a table on the page.
[
](https://docs.robusta.ai/wp-content/uploads/2022/10/image-25.png)
Case Examples
Case 1: Finding how many rows of data are in a table on a page.
With the “ Functions ” activity, it is possible to access the information on how many different currencies the daily exchange rates are given on the “TCMB” page.
[
](https://docs.robusta.ai/wp-content/uploads/2022/10/AppOpen.png)
Applications – Open – Properties
| * Application name | TCMBCurrencies | *URL | https://www.tcmb.gov.tr/kurlar/today.xml |
| *Type | Chrome | Maximize | ☑ |
Note: * Fields selected with are required, others are optional.
[
](https://docs.robusta.ai/wp-content/uploads/2022/10/AppFunc.png)
Applications – Functions – Properties
| * Application name | ${TCMBCurrencies} | *Field | //*[@id=”kurlarContainer”]/table[1]/tbody/tr[position()>1] |
| Result Variable Name | count | *Action | elementcount |
Note: * Fields selected with are required, others are optional.
Check “ How to Find “Xpath” ” to understand the “Field”.
How to Find “Xpath”
[
](https://docs.robusta.ai/wp-content/uploads/2022/10/Xpath-1.png)
Note
In this example, since the header is also considered a row, it is necessary to skip the first row in the Xpath. Therefore, Xpath should be written as:
//*[@id="kurlarContainer"]/table[1]/tbody/tr[position()>1]
[
](https://docs.robusta.ai/wp-content/uploads/2022/10/image-26.png)
Case 2: Refresh operation on a page.
The “ Functions ” activity can be used in cases where the page opened anywhere in the process needs to be refreshed and reloaded.
[
](https://docs.robusta.ai/wp-content/uploads/2022/10/Refresh2-1.gif)
Case 3: The process of checking whether a field on a page exists.
The “ Functions ” activity, it can be used in cases where it is necessary to check whether a field exists on a page.
- For example, it can control an error message on a page in the process.
[
](https://docs.robusta.ai/wp-content/uploads/2022/10/image-29.png)
In this example, an incomplete entry will be made to check whether the error has appeared. In other processes, these fields can be filled in completely and a control stage can be created with the “Gateway” structure and progress can be made according to this control.
[
](https://docs.robusta.ai/wp-content/uploads/2022/10/Case3Surec.png)
[
](https://docs.robusta.ai/wp-content/uploads/2022/10/AppOpen.png)
Applications – Open – Properties
| * Application name | FunctionsExist | *URL | https://uyg.sgk.gov.tr/vizite/welcome.do |
| *Type | Chrome | Maximize | ☑ |
Note: * Fields selected with are required, others are optional.
[
](https://docs.robusta.ai/wp-content/uploads/2022/10/AppSet.png)
Applications – Set methods – Properties
| * Application name | ${FunctionsExist} | *Field | //input[@name=”kullaniciAdi”] |
| * Text | RobustaAcademy | *Type | text |
Note: * Fields selected with are required, others are optional.
[
](https://docs.robusta.ai/wp-content/uploads/2022/10/AppMouse.png)
Applications – Mouse Actions – Properties
| * Application name | ${FunctionsExist} | *Field | //input[@name=”kaydet”] |
| Wait until load | ☑ | Wait until visible | ☑ |
Note: * Fields selected with are required, others are optional.
[
](https://docs.robusta.ai/wp-content/uploads/2022/10/AppFunc-2.png)
Applications – Functions – Properties
| * Application name | ${FunctionsExist} | *Field | /html/body/table[2]/tbody/tr/td/table[1]/tbody/tr/td[2] |
| Result Variable Name | control | *Action | exists |
Note: * Fields selected with are required, others are optional.
[
](https://docs.robusta.ai/wp-content/uploads/2022/10/TrueFalse.png)
Arrow – True – Properties
| Flow condition | ${control==true} |
| *Default Flow* | ☐ |
Note: * Fields selected with are required, others are optional.
Arrow – False – Properties
| Flow condition | |
| *Default Flow* | ☑ |
Note: * Fields selected with are required, others are optional.
[
](https://docs.robusta.ai/wp-content/uploads/2022/10/Log3.1-1.png)
