# Basics

GoLess is a web browser extension that allows users without coding skills to automate different browser tasks. For example, with GoLess, you can stop manually doing repetitive actions such as typing, clicking, and data fetching.

### How to Install the Extension <a href="#installing-extension" id="installing-extension"></a>

GoLess is now compatible with only Google Chrome and Firefox browsers. Choose the link below depending on your preferable browser:

[**Chrome Web Store**](https://chrome.google.com/webstore/detail/goless/ghlmiigebgipgagnhlanjmmniefbfihl)

### How to Start

GoLess offers two methods to create your workflow:

1. [Record your actions on the web](/readme/recording-actions)
2. [Add actions manually](/readme/adding-workflow-manually)


# Recording Actions

{% hint style="info" %}
The performance of this functionality may be suboptimal, or it may not operate as expected.
{% endhint %}

The recording feature is the easiest method to create a workflow in GoLess. First, go to the GoLess dashboard by clicking on the GoLess icon in your browser's top right corner. Then click the down arrow and choose "Record workflow" from the menu.

After this, GoLess will record all your activities. For example, you can record creating a new tab, scrolling, clicking, and typing patterns. Moreover, you can also choose any element on a recorded page to retrieve a list of attributes or text.

After you're done with recording, open the GoLess popup and click the ⏹️ button to stop. Watch the video tutorial to learn more about workflow recording.

#### Start Recording From a Specific Part in Workflow

Suppose you have already built a workflow and want to start recording from a specific part within the workflow. In that case, you can right-click on the output of the part and select "Record from here" from the menu.


# Adding workflow manually

If you want to build a workflow manually, do the following:

1. Open the dashboard by clicking the GoLess icon at the screen's top right.
2. Select "New workflow" and enter the name and some information about the new workflow.
3. Navigate to the newly generated workflow in the editor.
4. You will notice a trigger block in the editor where the workflow starts to execute. You can program the timing of the workflow to run in this block.
5. To add a block to the workflow, choose and drag a block from the list on the left side of the workflow. Next, to tie the trigger block with the added block, drag the trigger block output and drop it into the added block input.
6. When you are done adding blocks, save your workflow. You may then execute the workflow by clicking the playback icon.


# Tutorial: Scraping data

Getting basic data from websites.

In this tutorial, we're going to scrape data from this webpage: <https://demo.goless.com/>.

1. To get started, access the extension, open the dashboard and click on "New Workflow".

<figure><img src="/files/Pg3rM9pZurggx3uIUF4Z" alt=""><figcaption></figcaption></figure>

2. Your workflow will start with a trigger. A [trigger](/blocks/general/trigger) is an action defining when and under what conditions your automation should execute. By default, the trigger is set to "Manual" mode, meaning the automation will only run when you initiate it yourself.

<figure><img src="/files/MQ0WVg01dRpuMrVkzAy4" alt=""><figcaption></figcaption></figure>

3. You have the option to select a different trigger or add multiple triggers for your automation. These could include intervals, schedules, context menus (right-click on web pages), specific dates, on browser start-up, or keyboard shortcuts.

<figure><img src="/files/798sexoRbPy8LwUjmVlt" alt=""><figcaption></figcaption></figure>

4. Next, add the "[New tab](/blocks/browser/new-tab-block)" block. This means that upon automation initiation, a new tab will open with the address you specify, which in this case will be the webpage for scraping: <https://demo.goless.com/>.

<figure><img src="/files/mND8QebLWdpCbgCSBCOn" alt=""><figcaption></figcaption></figure>

5. Next, we add a "[Loop elements](/blocks/control-flow/loop-elements-block)" block. This block will iterate over the elements on the page as a list. We need to capture all blocks with the class `.post`. Thus, we specify the CSS Selector as `.post`.

<figure><img src="/files/JTQ8SDpBLBaD2CUARfEZ" alt=""><figcaption></figcaption></figure>

* To select this `.post` class, visit the demo.goless.com site and enable Element Selector in the extension.

<figure><img src="/files/fbJ9y5ZmNYp74iLYCR2U" alt=""><figcaption></figcaption></figure>

* We then hover our mouse over the desired block to obtain information about the required class.

<figure><img src="/files/65LlL20wxBPdLyGMUjRb" alt=""><figcaption></figcaption></figure>

6. Next, within the `.post` element, we need to get the title. To do this, we add a "[Get text](/blocks/web-interaction/get-text-block)" block to our workflow. In the settings, we specify: `{{ loopData@items }} .title` - here we instruct the script to take the elements from the previous block (items in our case, which should be pre-defined as **Loop ID**) and search within it for the CSS class `.title`.

<figure><img src="/files/qgwWtdlHoPhczSQyMmL1" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If you need to capture several fields and export them, you will need to set up a [table](/workflow/workflow-table). Select the "Insert to table" checkbox and choose into which field of the table the data should be added. Click on the table icon in the top-right corner beforehand to create a table format.

<img src="/files/3kPvXztth3KzfG2fzRcu" alt="" data-size="original"><img src="/files/Y56wCIKPoTrQPseqx7pT" alt="" data-size="original">
{% endhint %}

6. To terminate the loop, add a [Loop Breakpoint](/blocks/control-flow/loop-breakpoint) and specify the id of the Loop elements, which is `items` in our case.

<figure><img src="/files/IuzG9OTKXD7cGbjKiDMO" alt=""><figcaption></figcaption></figure>

6. The final block is the data export. You need to add an "[Export data](/blocks/general/export-data)" block to download the gathered data upon completion.

<figure><img src="/files/vcALbsBkrTn2BBrZ1cBb" alt=""><figcaption></figcaption></figure>

And with that, our workflow setup is complete. Upon running, the automation will save the data from the website in a csv file.


# Workflow

Warning: do not close the GoLess pop-up while running a workflow. Otherwise, the workflow will stop running.

When you are ready to run your workflow, open the dashboard, find the preferred workflow and click the playback icon.


# Customization

You can always set up each workflow by going to the workflow > settings menu. There are three sections in the settings menu:

## General

* Error Tracking: Choose what to do in the event of a workflow error.
* Running Mode: Choose to execute the workflow from a pop-up dashboard or in the background.
* Alarms: Turn alarms on/off when workflow stops.
* Debuging: Run the workflow using the Chrome DevTools Protocol.
* Autocomplete: Activates autocomplete in each block input.
* Reuse State: Use the state data such as tables, variables, and global data from the last run.
* Save Logs: Keep logs of the workflow.
* Show Executed Block: Show the block the workflow executes on the webpage at this moment. Note that this option only displays blocks in the "Web interaction" category (for example, Click Element and Forms blocks).
* Public ID: The public ID of the workflow that can be used in the execution of the workflow using Javascript CustomEvent.

When selecting "pop-up" or "background" for workflow execution, some features and benefits will not be available.

### Table

* Insert into Default Column: Insert the data into the default column if no column is chosen within the block or if the column does not exist.
* Default Column Name: The name of the default column.

### Blocks

* Block Delay: Add a delay before running each block.
* Tab Load Timeout: Maximal tab loading time in milliseconds.


# Blocks

There are six categories of blocks in GoLess:

* **General**: To conduct a general action within the workflow. For example, make an HTTP request or run another workflow.
* **Browser**: To control the browser.
* **Web Interaction**: To interact with the active tab of the workflow. Prior to using blocks in this category, you should use a New Tab or Active Tab block.
* **Control Flow**: To add logic to the workflow.
* **Online Services**: Services that connect to GoLess.
* **Data**: Change or manage variables or tables of a workflow.

## Block Settings

The blocks are accompanied by a menu and parameters that may be configured.

### Menu

To find the block menu, place your mouse on a block in the editor's canvas, and it will show up above the block.

* **Delete**: remove the block
* **Block settings**: open up current block parameters.
* **Move block to group blocks**: move the block to the Group blocks by dragging and dropping the icon.
* **Enable/disable block**: deactivate block
* **Run**: execute the workflow from the active block.
* **Edit**: access block properties or click twice on the block.

You can also right-click on the block for more menus.

![Block menu](https://res.cloudinary.com/chat-story/image/upload/v1666161166/automa/block-menu_lq1vig.gif)

### Settings

The Block settings enable you to set up the block execution, error handling, and how it looks like.

* **General**
  * **Debug mode**: use CSP to run the block. Please note that this option is only functional for some blocks - for example, the Click Element Block and Forms Block.
* **On error**
  * **Enable**: Activate the error handler for the block
  * **Retry action**: retry the block execution in the event of a block error
  * **Throw error**: when selected, the block will initiate an error
  * **Continue flow**: when selected, the workflow will continue to execute
  * **Execute fallback**: when selected, the workflow will resume to the block that connects to the fallback output
  * **Insert data**: insert data into the table or variable
* **Lines**
  * **Select line**: choose the block link to customize
  * **Line label**: add a label for the link
  * **Animated**: animate the link
  * **Line color**: change the link color

![Block settings](https://res.cloudinary.com/chat-story/image/upload/v1666162997/automa/block-settings_ppatjo.gif)

## Selecting Blocks

To select blocks, press the `ctrl` key => click the block or `shift` key => drag the cursor.

![Selecting blocks](https://res.cloudinary.com/chat-story/image/upload/v1666163436/automa/selecting-blocks_vecdy3.gif)

## Linking Blocks

You can link one block to another by using the following methods:

* **Manually**: by sliding the block output towards a block input. Example:![connect block manually](https://res.cloudinary.com/chat-story/image/upload/v1662968420/automa/connect-block_advdve.gif) :::
* **Drop a block into a block output**: drop one block to the output of another block. Example:![drop to output example](https://res.cloudinary.com/chat-story/image/upload/v1642573402/automa/connect-block-ouput_nn5nx7.gif) :::
* **Clicking on the block output and input**\
  ::: Example ![Clicking the block output and input example](https://res.cloudinary.com/chat-story/image/upload/v1662968420/automa/connect-block2_slxrpv.gif) :::
* **Drop one block into another one**\
  ::: Example ![drop to another block example](https://res.cloudinary.com/chat-story/image/upload/v1656734189/automa/drop_in_a_block_zzrtaw.gif) :::


# Global Data

You can use global data to specify global variables in your workflow. For instance, you have several new tab blocks where the URL entry has the same domain, e.g., "<http://dribbble.com>". You can define the URL domain in the global data instead of modifying one block at a time to change the URL domain.

```json
{
  "url": "https://dribbble.com"
}
```

Then, you can access the global data inside the URL text field of the New Tab block using an expression. In our example, we used this: `{{globalData.url}}`

![URL Input](https://res.cloudinary.com/chat-story/image/upload/v1642160825/automa/chrome_d3PsYXgOKK_weyqwy.png)


# Variables

As we know, variables are used to keep a value and are accessible throughout the workflow.

For instance, an extracted text by the Get Text block can be stored inside a variable. Later you can access that variable in another block.

## Variable Name

You are free to choose any name for the variable. But for ease of access to the variable inside a mustache tag, do not include space, at (@), and bracket (\[]) in the variable name.

## Variable in JavaScript Block

We can use variables created in Java Script in other blocks. To do this, create a `golessSetVariable` in a Java Script block before that, you can write code that will calculate the values for this variable.

After that you can pass this variable to other blocks that come after your block that creates this variable.

<figure><img src="/files/TNNsE2QucQiYzWOdW9SC" alt=""><figcaption><p>Create JavaScript code block and Delay Block like simple</p></figcaption></figure>

<figure><img src="/files/38FXERUwo6xgZ0yQamwI" alt=""><figcaption><p>Use: golessSetVariable</p></figcaption></figure>

<figure><img src="/files/SfNRKglaD56jZbJSsbp6" alt=""><figcaption><p>Set variable in Delay Block</p></figcaption></figure>

## Variable Prefix

GoLess utilizes symbols or prefixes in the variables' names. Also, it may use commands to demonstrate a specific purpose or functionality. For instance, `$$` indicates that the variable is kept on storage (e.g., `$$variableName`).

### `$$`

As we said above, the `$$` prefix indicates that the variable value is kept in the storage.

* **See also: Storage**

### `$push:`

By using `$push:` as a prefix, you tell GoLess to change the type of variable data to an array. If the variable already has a value, the value will change to the first element in the array. If you assign a value to the variable, GoLess will push this value into the variable instead of overwriting the value of the variable.

Suppose you make a loop through the elements and want to get the text of the element by using the Get Text block and setting the text of the element to a variable with `$push:` as a prefix `$push:texts`. On the first iteration, the value of the `texts` variable is `["Text 1"]`, on the second iteration`["Text 2"]`, etc.

### Functions you can use

* `$date` - get the current date.
* `$randint` - generating a random integer.
* `$getLength` - get the length of some data structure (string, list, etc.).
* `$slice` - extracting a subset or slice from a data structure.
* `$multiply` - perform multiplication operation.
* `$increment` - incrementing a value by one.
* `$divide` - performing a division operation.
* `$subtract` - performing subtraction operation.
* `$randData` - generation of random data.
* `$filter` - filtering data based on certain conditions.
* `$replace` - replacing a certain value with another one.
* `$replaceAll` - replacing all occurrences of a certain value with another.
* `$toLowerCase` - converts all characters in a string to lower case.
* `$toUpperCase` - converting all characters of a string to upper case.
* `$modulo` - performs the operation of taking the remainder from division.
* `$stringify` - converting some value into a string.


# Element Selector

ou can use the element selector to identify the page elements when interacting or retrieving data from the page. For instance, if you want the workflow to fill in a specific form on the page using the Forms block, it should know which input elements to fill in. By using the `input.form-name` selector, it instructs the workflow to fill in an [`<input />`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) element with `form-name` [classes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class).

In GoLess, you can pick an element utilizing the [CSS Selector](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors) or [XPath expression](https://www.w3schools.com/xml/xpath_syntax.asp).

## Block Selector Options

These options are available when editing a block that requires an element selector to function, such as the Click Element and the Get Text block.

### Multiple

Choose multiple elements that match the selector. GoLess defaults to selecting only the first item that matches the selector.

For instance, if you use the Get Text block with `p` as the selector, GoLess will fetch all the text content from the match elements instead of fetching text content from the first element that matches the selector.

### Mark Element

Mark your selected item. This means the element will not be selected if the same block has already selected it.

For instance, when you have a workflow as the following:

![Workflow example](https://res.cloudinary.com/chat-story/image/upload/v1642405439/automa/B2cPsIplxO_m06lfr.png)

and the Get Text block uses `.text` as the element selector, and the website [DOM tree](https://en.wikipedia.org/wiki/Document_Object_Model).

```html
<div>
  <p class="text" id="1">Text</p>
  <p class="text" id="2">Text</p>
  <p class="text" id="3">Text</p>
  <p class="text" id="4">Text</p>
</div>
```

After the Get Text block is started, it calls the first element that matches the selector, which is `<p class="text" id="1">Text</p>`. Then, since the mark element option is active, it will mark the element and look like this: `<p class="text" id="1" block--block-id>Text</p>`.

```html
<div>
  <p class="text" id="1" block--block-id>Text</p>
  <p class="text" id="2">Text</p>
  <p class="text" id="3">Text</p>
  <p class="text" id="4">Text</p>
</div>
```

When the Get text block is run for the second time, it will do the same. Still, instead of selecting the `<p class="text" id="1" block--block-id>Text</p>`, it will choose the `<p class="text" id="2">Text</p>` element because the first element was marked.

### Wait For Selector

Wait until the `selector` appears on the page. If the `selector` already exists while checking the `selector`, the block is immediately run. Otherwise, the workflow will throw an error if the `selector` doesn't appear in the `timeout` text field after the given time.

## Generating Selector

If you are unsure how to write your selector, utilize the GoLess Element Selector or the "Select" button on the block. GoLess Element Selector

Open the GoLess dashboard, click the button in the sidebar, and GoLess will inject an element selector into the current page. Click or press the space key to choose an item. It will automatically produce a selector for the chosen element.

![Element picker](https://res.cloudinary.com/chat-story/image/upload/v1666151274/automa/chrome_Kd5yzW80tf_sq2oxp.png)

Also, you can find the "Select an element" button when working with a block. When you click it, it will inject the element selector to the current page, choose an element, and click the "Select element" button in the element selector.

![Select an element button](https://res.cloudinary.com/chat-story/image/upload/v1666151714/automa/chrome_xQ16a4tU8v_etyuxh.png)

## Custom Selector Syntax

Also, GoLess supports a non-standard syntax to support standard [CSS Selector](https://www.w3.org/TR/selectors-4/) and XPath expression:

* `iframe-selector |> element-selector:` can select an element within an [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) element. For instance, `iframe.result |> button.primary-btn`
* `:contains(TEXT)`: choose an element based on the text. For instance, `p.description:contains("cat")`
* `shadow-dom-selector >> element-selector`: choose an element inside a [shadow DOM](https://web.dev/shadowdom-v1/). For instance, `div.app-container >> h1.title`


# Expressions

With this feature, you can define a dynamic value for a block based on the data from:

| Title           | Description                                                                                             | Access item                   |
| --------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------- |
| `table`         | Retrive data from the Table                                                                             | `table`                       |
| `variables`     | Retrive data from the Variables                                                                         | `variables.<variableName>`    |
| `loopData`      | Retrive the current iteration data of the Loop Data block                                               | `loopData.<loopId>`           |
| `prevBlockData` | Retrive the data of the previous block                                                                  | `prevBlockData`               |
| `globalData`    | Retrive the global data of the workflow                                                                 | `globalData`                  |
| `googleSheets`  | Retrive the Google Sheets data                                                                          | `googleSheets.<referenceKey>` |
| `activeTabUrl`  | Retrive the active tab url                                                                              | `activeTabUrl`                |
| `workflow`      | Retrive the data (Table and Variables) of the workflow that have been run by the Execute Workflow block | `workflow.<executeId>`        |

GoLess uses a mustache templating model and expands it with data from overhead and functions.

## Writing Expression

To write an expression, you should use the following format: "`{{ keyword }}`". Change the `keyword` with one of the data sources mentioned above. It helps GoLess distinguish static from dynamic data.

For example, assume that you have a variable named `socials` inside the workflow. Its value is an array of objects. You can use the HTTP Request block to send this variable to the API.

The following phrase can be used in the body of the HTTP Request block:

```
{{variables.socials}}
```

![HTTP Request block body](https://res.cloudinary.com/chat-story/image/upload/v1666171308/automa/chrome_FbRbTGuOXy_j8frph.png)

If you want to use the `url` property on the first element of the array as a value inside the New Tab block URL, you can use the following expression:

```
{{variables.socials.0.url}}
```

![New tab block URL](https://res.cloudinary.com/chat-story/image/upload/v1666232856/automa/chrome_8d0k1lZqUn_lxnycp.png)

The first element of the array here is expressed as `0`. Use `1` for the 2nd element of the array, `2` for the 3rd element, `3` for the 4th element, etc.

### Access Another Data Inside the Expressions

Wrap the expression with a bracket (`[]`) to access other data inside the expression. For instance, let's take the situation when you want to increment a variable using the [`$increment`](https://github.com/iglv/docs-goless/blob/main/workflow/broken-reference/README.md) function or get the table row based on the current index of the loop. In this case, you can write the expressions as follows:

```
{{$increment([variables.variableName]}}

{{table.[loopData.loopId.$index].columnName}}
```

## Functions

All built-in functions always begin with the prefix `$`, for instance, `$funcName(param)`; here is a reference list of available functions in GoLess.

### `$date(date, dateFormat?)`

This fuction gets or formats a date. It takes two parameters, the second parameter is optional.

Suppose you want to format the current date. In that case, you can pass the `dateFormat` straight as the first parameter. For example,`{{ $date('DD-MMMM-YYYY') }}`, and the output would be 14-January-2022. You can check all the available date formats on the [day.js page](https://day.js.org/docs/en/display/format#list-of-all-available-formats).

Also, you can check the valid date format on the [MDN page](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats#examples) for the `date` parameter.

**Examples**

```js
$date("DD MMMM YYYY") // 14 January 2022
$date("DD-MM-YYYY, hh:mm A")  // 14-01-2022, 02:24 PM
$date("relative") // A few seconds ago
$date("timestamp") // 1651118110948

$date("2005-06-07", "DD MMMM YYYY") // 07 June 2005
$date("1977-04-01T14:00:30", "DD-MM-YYYY, hh:mm A")  // 01-04-1977, 02:00 PM
$date("14 January 2021", "relative") // A year ago
$date("14 January 2021", "timestamp") // 1610553600000
```

### `$randint(min?, max?)`

Produces a random number. You can set up the range of the random number by entering the `min` and `max` parameters.

**Examples**

```js
$randint() // 30
$randint() // 14

$randint(0, 10) // 4
$randint(0, 10) // 7
```

### `$getLength(str)`

Gets the length of an array or string.

**Examples**

```js
// Get the length of a string
$getLength("testing") // 7

// Get tabel length
$getLength([table]) // 14

// Get the length of the "text" column on the second row
$getLength([table.1.text]) // 5
```

### `$randData(expression)`

This function generates random data. Pass an expression to its parameter and it will generate something random. For instance, `$randData("?l")` will produce a random minuscule letter like `a`. Supported expressions:

* `?l`: lowercase
* `?u`: uppercase
* `?d`: number
* `?f`: uppercase + lowercase
* `?s`: symbol
* `?m`: uppercase + number
* `?n`: lowercase + number
* `?a`: any

You can also mix several expressions together. For example, `$randData("?u?l?l?l?l?d?d@gmail.com")` will produce `Apond89@gmail.com`.

**Examples**

```js
$randData("?d?d") // 89

$randData("?l?l?l?d?d@gmail.com") // wal29@gmail.com

$randData("?d?u?s?l?l?s?a?m") // 4C%ee^MF9
```

### `$multiply(value, multiplyBy)`

Multiplies a value.

**Examples**

```js
$multiply(5, 2) // 10

// Multiply a variable
$multiply([variables.variableName], 0.3) //20.7
```

### `$increment(value, incrementBy)`

Increments a value.

**Examples**

```js
$increment(10, 2) // 12

$increment(72, 2) // 74
```

### `$divide(value, incrementBy)`

Divides a value.

**Examples**

```js
$divide(22, 7) // 3.142857142857143

$divide(10, 2) // 5
```

### `$subtract(value, incrementBy)`

Subtracts a value.

**Examples**

```js
$subtract(80, 7) // 73

$subtract(11, 2) // 9
```

### `$replace(value, search, replace)`

Replaces a `search` string from `value` with a `replace` string.

**Examples**

```js
$replace("hello world!", "world", "everyone") // hello everyone!

$replace("hello world!", "hello", "hi") // hi world!
```

### `$replaceAll(value, search, replace)`

Replaces all the matches string `search` from `value` with a `replace` string.

**Examples**

```js
$replace("hello world!", "o", "0") // hell0 w0rld

$replace("The temperature is 25 degrees today", " ", "") // Thetemperatureis25degreestoday
```

### `$toLowerCase(value)`

Converts value to a lowercase

**Examples**

```js
$toLowerCase("HELLO WORLD!") // hello world!

$toLowerCase("hELLO wORLD!") // hello world!
```

### `$toUpperCase(value)`

Converts value to a uppercase

**Examples**

```js
$toUpperCase("hello world!") // HELLO WORLD!

$toUpperCase("hELLO wORLD!") // HELLO WORLD!
```

### `$modulo(num, divisor)`

Returns the remainder or signed remainder of a division.

**Examples**

```js
$modulo(13, 5) // 3

$modulo(-13, 5) // -3

$modulo(4, 2) // 0

$modulo(-4, 2) // -0
```

### `$filter(data, syntax)`

Filter/Query javascript object. GoLess uses the [JSONPath](https://github.com/dchester/jsonpath) library to make a query.

* `data`: Javascript object to query
* `syntax`: [JSONPath Syntax](https://github.com/dchester/jsonpath#jsonpath-syntax)

**Examples**

Querying `colors` variable with these as the value:

```json
[
	{ color: "red", value: "#f00" },
	{ color: "green", value: "#0f0" },
	{ color: "blue", value: "#00f" },
	{ color: "cyan", value: "#0ff" },
	{ color: "magenta", value: "#f0f" },
	{ color: "yellow", value: "#ff0" },
	{ color: "black", value: "#000" }
]
```

```js
{{ $filter([variables.colors], "$..color") }}
// ['red', 'green', 'blue', 'cyan', 'magenta', 'yellow', 'black']

{{ $filter([variables.colors], "$..value") }}
// ['#f00', '#0f0', '#00f', '#0ff', '#f0f', '#ff0', '#000']
```

Using [JS Expressions](https://github.com/iglv/docs-goless/blob/main/workflow/broken-reference/README.md)

```js
!!{{ $filter(variables.colors, "$..color") }}
// ['red', 'green', 'blue', 'cyan', 'magenta', 'yellow', 'black']

!!{{ $filter(variables.colors, "$..value") }}
// ['#f00', '#0f0', '#00f', '#0ff', '#f0f', '#ff0', '#000']
```

### `$stringify(value)`

Converts JavaScript value to a JSON string.

## Examples

This section gives further examples of writing expressions and provides some information about the structure of the source data.

### Table

The table is stored as an array of objects with the table column as the object key.

```json
[
  { "color": "blue", "value": "#00f" },
  { "color": "cyan", "value": "#0ff" },
  { "color": "magenta", "value": "#f0f" },
  { "color": "yellow", "value": "#ff0" },
  { "color": "black", "value": "#000" }
]
```

* Get the first row:\
  expression: `{{ table.0 }}`\
  output: `{ "color": "blue", "value": "#00f" }`
* Get the second row:\
  expression: `{{ table.1 }}`\
  output: `{ "color": "cyan", "value": "#0ff" }`
* Get the last row:\
  expression: `{{ table.$last }}`\
  output: `{ "color": "black", "value": "#000" }`
* Get value of the `color` column on the first row:\
  expression: `{{ table.0.color }}`\
  output: `blue`
* Get value of the `value` column on the first row:\
  expression: `{{ table.0.value }}`\
  output: `#00f`

### Variables

The variables are stored as an object with the variable title as the object key.

```json
{
  "url": "https://goless.com",
  "numbers": [100, 500, 300, 200, 400]
}
```

* Get the value of the `url` variable:\
  expression: `{{ variables.url }}`\
  output: `https://goless.com`
* Get the value of the `numbers` variable:\
  expression: `{{ variables.numbers }}`\
  output: `[100, 500, 300, 200, 400]`
* Get the first number of the `numbers` variable:\
  expression: `{{ variables.numbers.0 }}`\
  output: `100`

## JavaScript Expressions

::: Note: this is only supported in the browsers based on Google Chromium :::

With GoLess, you also use javascript within the expressions. To write a javascript, you must add `!!` symbols as the first value on a text field of a block. For instance, from `The number is: {{variables.number}}` to`!!The number is: {{variables.number}}`.

![JS Expression](https://res.cloudinary.com/chat-story/image/upload/v1666237164/automa/TV_-_2_2_r3emea.png)

You can also use the integrated function like the javascript function.

**Examples**

* Use of integrated functionality:

```js
{{$getLength(table)}} //10

{{$randData("?d?d")}} // 89
```

* Get the last row of the table:

```js
{{table[table.length - 1].columnName}}
```

* Get current timestamp:

```js
{{Date.now()}} //1666237704022

```

* Access loop data and index:

```js
// Loop data
{{loopData.loopId.data}}

// Loop index
{{loopData.loopId.$index}}
```


# Workflow Table

A workflow table aims to keep the extracted data from a website. It is analogous to a spreadsheet. However, every column in the table is a strict data type.

## Adding Columns

Before you insert data in the table, you need to set a column for the table.

Open a workflow, then click the table icon () in the upper right corner. Enter the column name, then select the Add button. Next, you can choose the type of column data near the column you added.

There are 4 types of data you can choose from: `Text`, `Number`, [`Boolean`](https://en.wikipedia.org/wiki/Boolean_data_type), [`Array`](https://en.wikipedia.org/wiki/Array_data_type), and `Any`.

![Workflow table](https://res.cloudinary.com/chat-story/image/upload/v1666068922/automa/chrome_e9ZIOvxldR_pbauzp.png)

## Entering Data

You can enter data into the table using blocks used to extract data from a website: Get Text and Attribute Value blocks. To enter data using these blocks, click the Edit button, enable the "Insert in Table" option, and choose one of the columns.

![Select column](https://res.cloudinary.com/chat-story/image/upload/v1666076448/automa/chrome_05KtZ48UEI_oyrlmp.png)

Each time you enter data in the table, it will be pushed to the end row of the column. For instance, it happens when you fill a table with such data:

| `title`    | `price` | `urls`                                          | `available` |
| ---------- | ------- | ----------------------------------------------- | ----------- |
| Car        | 4000    | \["<https://en.wikipedia.org/wiki/Car>"]        | true        |
| Motorcycle | 2000    | \["<https://en.wikipedia.org/wiki/Motorcycle>"] | false       |

The table would look like this when the workflow runs a Get Text block and inserts the data into the title column:

| `name`     | `price` | `urls`                                          | `available` |
| ---------- | ------- | ----------------------------------------------- | ----------- |
| Car        | 4000    | \["<https://en.wikipedia.org/wiki/Car>"]        | true        |
| Motorcycle | 2000    | \["<https://en.wikipedia.org/wiki/Motorcycle>"] | false       |
| Boat       |         |                                                 |             |

In the workflow, the table kept an array of objects.

```json
[
  {
    "name": "Car",
    "price": 4000,
    "urls": ["https://en.wikipedia.org/wiki/Car"],
    "available": true
  },
  {
    "name": "Motorcycle",
    "price": 2000,
    "urls": ["https://en.wikipedia.org/wiki/Motorcycle"],
    "available": false
  },
  {
    "name": "Boat"
  }
]
```

## Exporting Table Data

Use the Export Data block to export the table to a file. You can choose to export the table in "Text", "CSV", or "JSON" file format.


# Looping

You can use looping to perform the same actions several times. It stops only after all the items have been looped.

The loop is useful when you want to process several similar elements, such as completing forms that values come from a Google sheet. You can use several methods of looping in GoLess:

1. The Loop Data blocks can be used to loop through a table, Google spreadsheet, variable, or custom JSON Array.
2. The Loop Elements block can be used to loop through elements on one page.
3. The Repeat Task block can be used for frequently repeating actions a specified number of times.

## Working with the Loop Data or Loop Elements Block

The Loop Break point must be included in the workflow when using the Loop Data or Loop Elements block. The Loop Break point lets you tell the workflow where the loop reach is. Also, inside the Loop Break point, you have to enter the loop block's loop ID.

![Loop with breakpoint](https://res.cloudinary.com/chat-story/image/upload/v1666320965/automa/chrome_7wEPnPfNRQ_e1ee2l.png)

The workflow above will constantly run the Forms and the Get Text block depending on the number of elements. After all elements are looped, the workflow moves to the Export Data block.

If you don't set the loop range using the Loop Break point block, the loop won't work.

![Loop without breakpoint](https://res.cloudinary.com/chat-story/image/upload/v1666320717/automa/chrome_csX5PLkZBq_h5hu0k.png)

The above example will run the Forms and the Get Text block one time and move on to the Export Data block.

### Access Loop Item

Expressions can be used to access data from the current loop iteration inside the loop range. For instance, replace the `loopId` with the Loop id you inputted inside the Loop Data or Loop Element block: `{{loopData.loopId}}`.

![Access loop item](https://res.cloudinary.com/chat-story/image/upload/v1666321501/automa/chrome_Z1IwOcaATY_gxfn6k.png)

The `{{loopData.loopId}}` expression will return:

```json
{
  "data": ...,
  "$index": 1
}
```

To sum it up, if you need to access the loop index, you can use expressions like`{{loopData.loopId.$index}}`. To get the loop value, you don't need to enter the `data` property like `{{loopId.loopId.data}}`, GoLess will automatically set it to the expressions. However, for JavaScript expressions, you should include the `data` property `!!{{loopData.loopId.data}}`

## Usage of the Repeat Task Block

The Repeat Task block is the simplest way to make a loop. Simply define how often to repeat the actions and where to start repeating them.

![Repeat task](https://res.cloudinary.com/chat-story/image/upload/v1666322277/automa/chrome_LWjlxa5ZMT_t2jrr2.png)

The above example will repeat executing the Click Element block three times. After that, the workflow will continue to the New Tab block.


# Google Drive

You can interact with Google Sheets or upload files to your Google Drive through GoLess. This requires setting up a connection between GoLess and your Google Drive.

This connection is necessary if you're using the Google Sheets (GDrive) and Google Drive block features in GoLess.

Here are the steps to connect Google Drive:

1. [Visit the integrations page](https://goless.com/profile) on GoLess's website.
2. Find the Google Drive card and click the "Connect" button on it.
3. Choose the same Google account that you use for logging into GoLess.
4. If you have the GoLess Extension Dashboard open, you'll need to close and reopen it for the changes to take effect.


# General


# Note Block

Description of the Note Block work

<figure><img src="/files/MJhmV5buRBg32SdXQ1IP" alt=""><figcaption></figcaption></figure>

This element is not a workflow block and has no connecting inputs or outputs. It is just a text note that is placed in the workspace for clarification. In the element settings, you can select the background color.

<figure><img src="/files/mVx5DxTHIfTeL2NiPcZL" alt=""><figcaption></figcaption></figure>


# Trigger Block

Description of Trigger Block work

<figure><img src="/files/hGWLP3nLQe0PEfm25W86" alt=""><figcaption></figcaption></figure>

This block is the first block from which the workflow will start, you can customize how the workflow should start using this block. To access the block settings, place the block on the workspace, use the settings button above the block.

<figure><img src="/files/e47ha6MuKxdqQsAVfYm3" alt=""><figcaption></figcaption></figure>

Two buttons are available in the block settings: Edit Triggers, Parameters. The first button gives access to setting the trigger type. By default, when adding a block, the Trigger Type setting is set to Manually trigger. The types of triggers available for adding are listed below with decoding.

***Trigger type***

**Manually**

Start the workflow manually by pressing the playback button (▶).

**Interval**

Execute the workflow at intervals, you can define the interval and delay before executing the workflow in the submitted input data.

**On a specific date (On a specific date)**

Perform the workflow on a specific date and time.

**On a specific date (On a specific day)**

Complete the workflow on a specific day and time.

**On browser startup ( On browser startup )**

Perform the workflow when the browser profile that has this extension installed starts.

**Cron job (Cron job)**

Execute a workflow on a specific day and time. The command is specified in the corn style. Five columns specify the execution time ([minute](https://ru.wikipedia.org/wiki/%D0%9C%D0%B8%D0%BD%D1%83%D1%82%D0%B0), [hour](https://ru.wikipedia.org/wiki/%D0%A7%D0%B0%D1%81), [day](https://ru.wikipedia.org/wiki/%D0%94%D0%B5%D0%BD%D1%8C), [month](https://ru.wikipedia.org/wiki/%D0%9C%D0%B5%D1%81%D1%8F%D1%86), [day of the week](https://ru.wikipedia.org/wiki/%D0%94%D0%B5%D0%BD%D1%8C_%D0%BD%D0%B5%D0%B4%D0%B5%D0%BB%D0%B8)), and can contain a number, a comma-separated list of numbers, a range of numbers separated by hyphens, \* or / characters. To read about the corn style, go to [https://en.wikipedia.org/wiki/Cron.](https://en.wikipedia.org/wiki/Cron)

Examples of assignments:

<figure><img src="/files/qFzUte5aveN94gOwhS6F" alt=""><figcaption></figcaption></figure>

**Context menu (Context menu)**

Run the workflow through the context menu (by right-clicking). When the workflow is executed via the context menu, several variables will be entered into the workflow:

$ctxElSelector: Selector of the item you right-click on

$ctxTextSelection: Selected text

$ctxMediaUrl: URL of the source of the multimedia item (image, video or audio)

$ctxLink: The URL you right-click on the link

But to use this trigger, you must grant autonomy to use the ContextMenu permission. This trigger has two options

* Workflow name in the context menu
* A window appears, with which you can set when the workflow appears in the context menu. If none of these options is selected, it will be displayed each time the context menu is displayed.

**When visiting a website (When visiting a website)**

You can start the workflow when you visit a website that matches the URL or regular expression you entered. Then, when you select the Use regular expression check box, the value you enter is treated as a regular expression.

**Keyboard shortcut (Keyboard shortcut)**

Perform the workflow using a keyboard shortcut. You can specify a keyboard shortcut by clicking the "Record" button ( ) and pressing the key you want to use.

\\

And by default the shortcut doesn't work when the cursor is on an input item, so to prevent this behavior you can check the "Active while typing" checkbox.

**Important:**

The keyboard shortcut works only when you are on a website. If the website URL starts with chrome:// or chrome-extension://, the shortcut will not work.

\\

**Use JSCustomEvent for the trigger**

The workflow can be triggered with a JavaScript CustomEvent that you can embed in your website. Take a look at an example:

// Using workflow Id

window\.dispatchEvent(new CustomEvent('goless:execute-workflow', {

detail: { id: 'workflow-id' }

}));

\\

// Using workflow publicId

window\.dispatchEvent(new CustomEvent('goless:execute-workflow', {

detail: { publicId: 'public-id' }

}));

In the detail property, you must define an identifier or public identifier for the workflow to run. You can then specify the public workflow identifier in the workflow parameters.

<figure><img src="/files/W1JRlKcrONAYhxDD4wdD" alt=""><figcaption></figcaption></figure>

Then, to add variables to this workflow, add dataproperty to the custom event property.

// Using workflow Id

window\.dispatchEvent(new CustomEvent('goless:execute-workflow', {

detail: {

id: 'workflow-id',

data: {

variables: {

name: 'John Doe',

search: 'Hello world'

}

}

}

}));

**Parameters button**

Define the parameters for the workflow. Let's say you have a workflow to automate keyword searches across multiple search engines, and the keyword changes each time you run the workflow. You can add a parameter to the Trigger block where you can enter the keyword each time you run the workflow.

**Add a parameter**

To add a parameter to your workflow, you need to:

1. Open a workflow
2. Click the Edit button on the launcher
3. Click the Options button.
4. Click the "Add Parameter" button.

You can rename a parameter, select a parameter type, or enter a default value:

1. Parameter name. Required to refer to a parameter via the name of a variable in the program. Example: {{ variables\@param }}
2. Parameter Type. Can be one of 5 types.
3. The name of the parameter displayed at startup.
4. Default value. It is displayed in the parameter input element when the workflow starts and is available for changing the value.
5. Description. The user can enter a text description of the parameter.
6. Placeholder. A placeholder prompt that is displayed in the parameter input element when the workflow is started. It differs from the default value in that the parameter value itself remains empty unless entered by the user.
7. Required parameter. This checkbox allows you to require the user to fill in a parameter when starting the workflow.
8. Allows you to customize the input mask.

<figure><img src="/files/E9Rk2lKQNLSzvIM97vCN" alt=""><figcaption></figcaption></figure>

Parameter types

* Checkbox
* Google Drive Sheet
* Input (number)
* Input (string)
* Textarea

When you start the workflow, a pop-up window will appear where you enter the parameter value.


# Execute Workflow Block

Description of the Execute Workflow Block work

<figure><img src="/files/vqmLZljnvSgB2Jy2dShl" alt=""><figcaption></figcaption></figure>

This block executes a third-party workflow. You can configure which workflow should run in the block settings. To access the block settings, place the block on the workspace, use the settings button above the block.

<figure><img src="/files/vha3gpdysuEf88GyFI0X" alt=""><figcaption></figcaption></figure>

The block settings are described below. List of workflows (Select workflow) Select from the list of available workflows the workflow to run

<figure><img src="/files/gVr5QHTYd3yrFgSoNY5i" alt=""><figcaption></figcaption></figure>

**Execute Id**

An identifier to determine when you want to access the executed workflow inside the expressions . The executed workflow will return its table and variables . For example, {{ workflow\.executeId.table }} Replace executeId with the value you entered.

<figure><img src="/files/TSiLtI4piSYMZm7V3fz7" alt=""><figcaption></figcaption></figure>

**Global data**

Overwrite the global data of the selected workflow.

<figure><img src="/files/twuOQvRNfiVBvWnzr841" alt=""><figcaption></figcaption></figure>

**workflow variables**

Use variables in the workflow to be run. You can use all or selected variables.

<figure><img src="/files/c6pD1aCk6Mkos77k3ULb" alt=""><figcaption></figcaption></figure>


# Delay Block

Description of Delay Block work

<figure><img src="/files/K7d0XIsBrebvBrLlSlNs" alt=""><figcaption></figcaption></figure>

This block performs a delay (in milliseconds). Add it to your workflow if you want to wait for asynchronous operations, such as loading a browser page.\
\\


# Export Data Block

Description of the Export Data Block work

<figure><img src="/files/VIhlB1lobCkaFFUF7Z8p" alt=""><figcaption></figcaption></figure>

This block performs data offloading from the workflow. It currently supports multiple unloading sources:

* Internal workflow table (Table)
* a previously connected Google table (Google Sheets)
* Workflow Variable (Variable)

A reference key must be specified for the table. This string is used to identify a table previously added to the workflow. For a variable you must specify a name. Add the name of the upload file (File name) and select one of the types of upload formats:

* json
* csv
* plain text


# HTTP Request Block

Description of the HTTP Request Block work

<figure><img src="/files/lYEuAlpeS1CDfVuCo6Wl" alt=""><figcaption></figcaption></figure>

This block makes an HTTP request. Five request methods are supported:

* GET - Used to request the contents of a specified resource
* POST - Used to transfer user data to a specified resource
* PUT - Used to load the contents of the request to the URI specified in the request
* PATCH - Similar to PUT, but applies only to a fragment of the resource
* DELETE - Deletes the specified resource

The screenshot below shows the block settings with a detailed description.

<figure><img src="/files/Fk62zinVFzkwVDXRJGr2" alt=""><figcaption></figcaption></figure>

1. Request method.
2. UrI specifies the path to the requested document.
3. Content type in queries (such as [POST](https://developer.mozilla.org/ru/docs/Web/HTTP/Methods/POST) or [PUT](https://developer.mozilla.org/ru/docs/Web/HTTP/Methods/PUT)), the client tells the server the type of data to send.
4. The request header can be added using the Add header button
5. Setting up a response from the server in the block:

* Response type. The response format can be in three options: json, text, base64. For json, the Data path setting is available
* The response data can be written to a variable or workflow table

**Data path**

<figure><img src="/files/rOzzF0D5DcuZmW1x76z1" alt=""><figcaption></figcaption></figure>

If you want to receive part of the json response data, you can use the Data path setting.For example, when the response returns this data:

{

"status": 200,

"data": {

"name": "Prices",

"values": \[

{ "id": 1, "value": 4000 },

{ "id": 2, "value": 24000 }

]

}

}

To obtain values array, write data.values as a path. And to get the first value of the array values, write data.values.0.

\\


# Blocks Group

Description of Blocks Group work

<figure><img src="/files/CRhy8u8Y9Q3cj3HeXUi0" alt=""><figcaption></figcaption></figure>

Groups other blocks within the same container, so you can make your workflow more organised. Blocks within a blocks group are executed sequentially based on the order of the blocks from top to bottom. Add a block to the work form, drag and drop the left panel elements into the selected area of the Blocks group block as shown in the screenshot. The Blocks group block is ready to work.

<figure><img src="/files/1DnBsHjknW0wbNr2DMVC" alt=""><figcaption></figcaption></figure>


# Clipboard Block

Description of the Clipboard Block work

<figure><img src="/files/3ISGY0PS7HjkpEwKW5ul" alt=""><figcaption></figcaption></figure>

The Clipboard block works with the operating system's clipboard. Two operating modes are available:

* Getting data from the clipboard (Get clipboard data) - this mode allows you to get data from the clipboard into a workflow variable or an internal table, depending on the settings.

<figure><img src="/files/hvxxEXf3E28OYkwvCVSa" alt=""><figcaption></figcaption></figure>

* Insert text to clipboard - allows you to insert data into the clipboard. In the first mode, you can paste information into a text field. The second allows you to copy a selected fragment of an http page to the buffer.

<div><figure><img src="/files/Gl2pK8XINHU2XxXSJmSP" alt=""><figcaption></figcaption></figure> <figure><img src="/files/r9Wn7voCXhrhizj5GDAM" alt=""><figcaption></figcaption></figure></div>


# Wait Connections Block

Description of Wait Connections Block work

<figure><img src="/files/0YKPQsG3n3fzQ3ao3KAR" alt=""><figcaption></figcaption></figure>

In Goless visual programming system you can execute a group of blocks in parallel. It is enough to create a branch on one of the blocks and we will get two parallel execution threads in the workflow as shown on the screenshot.

<figure><img src="/files/tHAHb0zLnM1hlwEsGQFG" alt=""><figcaption></figcaption></figure>

Note that no condition blocks are placed here, so both branches can be executed simultaneously. To wait for the execution of all the parallel threads of execution in the workflow, we need the Wait Connections block. *The Timeout (milliseconds)* value of the block sets how long the block waits for the whole thread to finish execution, the default value is 10 000 ms (10 seconds). When the timeout is reached, the workflow will continue to execute the next block.

**Only Continue a Specific Flow**

This option in the block allows you to select a single execution flow. If you select this option, a drop-down list of items connected to the block's input appears.

<figure><img src="/files/6Lb8fjskgzzf6K1HKLQr" alt=""><figcaption></figcaption></figure>

Note that without the Only Continue a Specific Flow option, the third New Tab block is executed 2 times in two execution threads. After the option is enabled in the settings, you can select the flow by its last element.

<figure><img src="/files/XqkDgsMnxfv3q6zV3Xhm" alt=""><figcaption></figcaption></figure>

After selecting one of the threads, the third New Tab block is executed 1 time after the Wait Connections block. Both execution threads before the Wait Connections block are successfully executed.


# Notification Block

Description of Notification Block work

<figure><img src="/files/Q3TgzcwARxWH5RnNR52w" alt=""><figcaption></figcaption></figure>

This block is required to display a text pop-up message in the bottom right corner of the screen. The first time you use this block, click the edit block button and click the grant permission button. If the notification is not displayed, try reloading your browser. And if you are using Mac OS, you must allow the browser you are using to show notifications in the system settings.\\

<figure><img src="/files/qR3uFUzf8chc6TdEBEZF" alt=""><figcaption></figcaption></figure>

* Title

The title of the notification.

* Message

The message of the notification.

* Icon URL

The URL of the icon for the notification.

* Image

URL URL of the image to be notified.


# Workflow State

Description of the Workflow State work

<figure><img src="/files/XhDc6D8Il46hvMs3jVKR" alt=""><figcaption></figcaption></figure>

State block This block allows you to manage workflow states.

<figure><img src="/files/2syt01czSnumvQtcaUU3" alt=""><figcaption></figcaption></figure>

There are only 3 possible states in the block settings:

* Stop all workflows. Stop all workflows that are currently running. For this item there is an additional option Except for the current workflow (Except for the current workflow ), which allows you to leave the current workflow running.
* Stop current workflows.
* Stop specific workflows. Allows you to select a specific workflow to stop.

<figure><img src="/files/WfZpAvkHNYSq36D6wZWK" alt=""><figcaption></figcaption></figure>


# Parameter Prompt Block

Description of Parameter Prompt block work

<figure><img src="/files/B0LuLHLBWDyRgo8klskw" alt=""><figcaption></figcaption></figure>

The function of this block is similar to the Parameters button of the Trigger block and allows you to show a pop-up prompt for user input. [(Trigger block)](/blocks/general/trigger). The only difference is an additional parameter:

* Timeout. The maximum time the user can enter parameters in milliseconds. If the timeout has expired, the workflow will continue with the next block.

\
\\


# Browser


# Active Tab Block

<figure><img src="/files/SthB521vbOyTcM0NF3sP" alt=""><figcaption></figcaption></figure>

Set your current tab as an **active tab**. The active tab here means a tab where the block requires a tab like a take screenshot block will execute.

For instance, when you run a JS code on a current website or make a screenshot, you can use the active tab before connecting others (like the *take a screenshot* or *javascript code* block).

<figure><img src="/files/OJpxc7v4AiU2jYbuDqST" alt=""><figcaption></figcaption></figure>


# New Tab Block

<figure><img src="/files/T6xjvkKpSl7zrOOp0yRW" alt=""><figcaption></figcaption></figure>

The New Tab block creates a new browser tab that the workflow can interact with.

**New Tab Block**, starts the interaction with the tab that you set it.

To start a workflow, you must specify the URL where the workflow will take place.

{% hint style="info" %}
Please note that when entering the URL in the entry field, the address must begin with **http\://** or **https\://**.
{% endhint %}

The block settings are shown in the screenshot.<br>

<figure><img src="/files/EQ22CpGUMQDYq1ZM2oA5" alt="" width="323"><figcaption></figcaption></figure>

The main setting is the New tab URL. Here you need to enter the URL of the browser page that you want to interact with from the workflow.

You can also set additional options for the tab you want to open.

* **Update previously opened tab.** Use this option if you need to open a page in a previously opened tab. Initially, you need to open a new tab using the New Tab block. Next, you need to place a new block on the work field with the Update previously opened tab setting. When the workflow is running, the initially opened page on the tab changes according to the settings of the second New Tab block.

<figure><img src="/files/71pFNRUvFJCgwxE3dOa7" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/RxJoPd6E9ABvuWVwlN7u" alt=""><figcaption></figcaption></figure>

* **Wait until the table is loaded.** It is useful to set this setting, because often errors in the workflow arise due to the unavailability of the open page itself to work, it may not be fully loaded by the time the next block is executed.
* **Set as active tab.** This setting allows the browser to switch to a newly created tab, as a person does to view a site page. The setting is set by default when placing the New Tab block.
* **Add tab to a group.** In the Google Chrome browser, it is possible to create a group of tabs to work faster using keyboard shortcuts. Using the setup, only one group is created for the workflow.
* **Use custom User-Agent.** This setting determines how your browser identifies the website. The display of the site in the browser may depend on this. You can change this value to the one you need.

<figure><img src="/files/giWVmJDN5lh4qTnCxrTp" alt="" width="320"><figcaption></figcaption></figure>

You can also specify additional settings for the new tab block

<figure><img src="/files/Os92J2aPFatsAZwlMz3l" alt="" width="381"><figcaption></figcaption></figure>


# Switch Tab Block

Switch between tab

<figure><img src="/files/rXWwgltU8cmIVq6wWs4E" alt=""><figcaption></figcaption></figure>

The Switch Tab block allows you to switch to a specific browser tab. The following settings are available for searching and switching to the tab:

* **Match Patterns.** The tab is searched by a template. For example, a Switch Tab block with a template <https://google.com> /\* switches to the tab with the site open in it google.com . More template examples are available on the [MDN Page](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns#examples). his setting has several sub-items:

1. **Create if there's no match.** If a template tab is not found, a new tab is created.
2. **Set as active tab.** This setting allows the browser to switch to a newly created tab, as a person does to view a site page.

* **Tab title.** Switch to the tab by the tab title. This setting has several sub-items as in the previous setting.
* **Next Tab.** Go to the next tab of the active tab. Can be set as an active tab.
* **Previous Tab.** Go to the previous tab of the active tab. Can be set as an active tab
* **Tab Index.** Proceed to the tab based on its index position. For instance, assume that four tabs are opened (Google, GitHub, Chess, and Microsoft). Then, if you need to open the Google tab, you can enter 0. For the GitHub tab, enter 1, etc.


# New Window Block

Create a new window

<figure><img src="/files/R9OiP3Oq5yfqoHVKWF8n" alt=""><figcaption></figcaption></figure>

The New window block allows you to create a separate browser window. The following block settings are available:

* **Type**. The type of window to open. There are three types of windows to use:

1. **Normal**. This is a type of regular window in which all the main window controls are available.
2. **Popup**. This type of window opens without the browser's address bar. It is used based on the name as a pop-up window to display information.
3. **Panel**. This type of window also opens without the browser's address bar. It does not visually differ from the previous type.

* **URL**. Optionally, you can specify the site address to display in the window.
* **Window state.** The position and appearance of the window being opened. There are four kinds of windows to use:

1. **Normal.** This is the view of an ordinary window. In this setting, you can specify the coordinates of the upper-left corner of the window and its dimensions.
2. **Minimized.** This is the view of a collapsed window. In order to use the window, you need to expand it from the taskbar.
3. **Maximized.** This is the view of the window expanded to the full screen.
4. **Full screen.** Opens the window to the full screen. The difference from the previous paragraph is the absence of any window controls, only the content of the site is displayed on the entire screen.

* **Set as an incognito window.** This setting allows you to switch the window to a mode that allows you not to save information about your actions in the browser. In order for this setting to work, you must enable "Allow login in incognito mode" for the Goless extension in the browser. To do this, go to chrome://extensions => find Goless and scroll down. Check the box next to the "Allow in incognito" setting.

<figure><img src="/files/ino7NhQQGftsPkbuKGUN" alt=""><figcaption></figcaption></figure>


# Proxy Block

<figure><img src="/files/9JqN4oL9npquwXwAVznu" alt=""><figcaption></figcaption></figure>

The Proxy block allows you to use a browser proxy server for your needs. The following block settings are available:

* **Scheme.** The default scheme (protocol) of the proxy server is `https`.
* **Port.** The port of the proxy server. When no port is set, the port will be taken from the scheme.

| Scheme | Port |
| ------ | ---- |
| http   | 80   |
| https  | 443  |
| socks4 | 1080 |
| socks5 | 1080 |

* **Host.** In this setting, the proxy server host or ip address with the scheme (protocol) is specified. For example <https://example.com> .
* **Bypass List.** You can exclude some websites from using a proxy. Use the comma to separate the URL or URL model. E.g., google.com, \*.google.com. View all valid URLs or templates on the [chromium page](https://developer.chrome.com/docs/extensions/reference/proxy/#bypass-list).


# Go Back Block

<figure><img src="/files/4IM2B41OXU2lrCEMwJqP" alt=""><figcaption></figcaption></figure>

Return to the previous page of the tab.


# Go Forward Block

<figure><img src="/files/LV9dJbbtMW8Qs7roNcI9" alt=""><figcaption></figcaption></figure>

Continue to the next page of the tab.


# Close Tab/Window Block

<figure><img src="/files/KLWxLJpzP9bz6eMwjTVC" alt=""><figcaption></figcaption></figure>

Close the tab or window. There are two block settings:

* **Tab.** The setting closes the tab. Closes the active tab by default (Close active tab). If you uncheck Close active tab, the setting opens for entering the URL or template ( [match patterns](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns#examples) ) of the site that needs to be closed. For example <http://example.org> / or *://*.example.org/\*
* **Window.** Closes a previously opened window. The Close all windows setting is available here, which closes all open browser windows.


# Take Screenshot Block

<figure><img src="/files/2y1fYnTOKt0HTo1VlZXQ" alt=""><figcaption></figcaption></figure>

Used to create a screenshot of the current tab. You can use three modes: A page (screenshot of the page), A full page (screenshot of the entire page), An element (screenshot of a page element). There are settings for these modes:

* **Save screenshot to computer.** Here you need to enter the name and select the file format to save.
* **Insert screenshot to table.** The so-called [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) is written to the table, which is a text string containing a Base64-encoded image.
* **Assign to variable.** The [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) is written to the workflow variable. For the block to work correctly, enter the name of the variable previously declared in the program.
* **CSS Selector.** For the An element mode, you must specify the selector of the element for the area of which you want to take a screenshot of the screen.


# Browser Event Block

<figure><img src="/files/9PQAuFpGmTqEVAipeJGN" alt=""><figcaption></figcaption></figure>

Await the triggering of the selected event before running the next block.

* **Timeout (milliseconds)**\
  Set the workflow timeout for the selected event (by default, it is 10000ms - 10 seconds). After the time is up, the workflow continues to execute the block.
* **Events.** An event you would like the workflow to await.
  * **Tab closed.** Wait until a tab has closed.
  * **Tab loaded.** Wait for the current tab or the tab that the URL matches the [match patterns](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns#examples) to be loaded.
  * **Tab/Window created.** Wait for a new tab/window to be created. A filter is provided for this setting.
    * **Filter.** Filter the URL for the new tab or window. If the URL matches the URL or Regex you entered, the workflow will keep running the blocks.
    * **Active tab.** Define the created tab or window as the current tab.
  * **Window closed.** The event occurs when the window closes.


# Handle Download Block

<figure><img src="/files/xA9ldWDIX7tdyikFYbQp" alt=""><figcaption></figcaption></figure>

This block processes the downloaded file. Please note that the block must be set before the file is uploaded. You need to use this block before the process of downloading a file from the site begins. For example, when the download occurs after clicking on the download button.

<figure><img src="/files/haLGLmm4FA8eJDaftGMo" alt=""><figcaption></figcaption></figure>

Below is a screenshot of the block settings.

<figure><img src="/files/P7JV8iHkdXLRVQ1oHH4I" alt=""><figcaption></figcaption></figure>

Settings of the Handle Download block:

* **Timeout.** Set the workflow pending time for the downloaded file to complete (by default, it is 20000ms - 20 seconds. After the time is up, the workflow continues to execute the block.
* **Download id.** The id of download item to handle. File download ID is a unique identifier that is assigned to the downloaded file. This identifier is used to track the download process, as well as to ensure security and control access to the file.
* **File name.** The name of the downloaded file. Leave this field empty if you want to keep the name unchanged.
* **On conflict.** Indicates what to do if a downloaded file's name conflicts with an existing file.
  * `"uniquify".`The browser will change the file name to be unique..
  * `"overwrite".`The browser will overwrite the old file with the recently uploaded file.
  * `"prompt".`The browser will ask the user to make a choice between uniquify or overwrite.

<figure><img src="/files/VEE1ZDjeAL8GfEASP58O" alt=""><figcaption></figcaption></figure>

* **Wait for the file to be downloaded.** Wait until the file is completely downloaded before continuing to the next block. Setting this setting allows you to access the ability to save information about the uploaded file to a variable or table.

<figure><img src="/files/Ly2pRWrgO0o11WxjOEGa" alt=""><figcaption></figcaption></figure>

* **Assign to variable.** Defines whether the downloaded file's path will be assigned to a variable or not.
* **Variable name.** Variable name to assign a file path.
* **Insert to table.** Defines whether to insert or not the filepath in the table.
* **Select column.** A column to insert the file path.


# Handle Dialog Block

<figure><img src="/files/lxn21ANJ3i05GkdlXbQd" alt=""><figcaption></figcaption></figure>

This block accepts or rejects a dialogue launched by a JS (alert, confirmation, prompt, or onbeforeunload). You must use this block prior to the dialog box appearing. For instance, when a dialogue box appears after clicking on an element.

<figure><img src="/files/rNHE8GDv4xG4S2CovsCI" alt=""><figcaption></figcaption></figure>

* **Accept dialog.** Accept or reject the dialog prompt.
* **Prompt text.** This is the text to enter into the dialog prompt before accepting. It is used only in a prompt dialog box.


# Reload Tab Block

<figure><img src="/files/AGfCELah25zw5Y1nqQPH" alt=""><figcaption></figcaption></figure>

This block reloads the current tab.


# Get Tab URL Block

<figure><img src="/files/HO5vI8kLGugdIbUIRz0h" alt=""><figcaption></figcaption></figure>

This block allows you to get the addresses of browser tabs. Screenshot of the block settings below.

<figure><img src="/files/9SHA8wdJHxPQfIfrAIk8" alt=""><figcaption></figcaption></figure>

The main menu of the Select tab settings contains two values:

* **Active tab.** Get the address of the active tab.
* **All tabs.** Get the addresses of all tabs. In this mode, the Query menu is available, which allows you to select only the necessary tabs to get addresses.

<figure><img src="/files/NmLiG3TW4uMjwWwMkJKm" alt=""><figcaption></figcaption></figure>

* **Match Patterns** is a filter that allows you to select tabs based on the address template.&#x20;
* **Tab title** - a filter that selects tabs by title.&#x20;

The resulting addresses can be put in a variable or a workflow table.&#x20;

* To configure **Assign to variable**, you must enter the name of the variable.&#x20;
* To configure **Insert to table**, select a table column.

<figure><img src="/files/AsUigToEvBB9cfNzxTkk" alt=""><figcaption></figcaption></figure>


# Cookie Block

<figure><img src="/files/2GEWiUSQ3KleQUwbBDJW" alt=""><figcaption></figcaption></figure>

This block allows you to receive, set or delete cookies. The block settings contain three modes of operation:

* **Get cookie.** In this mode, the block receives cookies. Below is a screenshot with the settings of this mode.

<figure><img src="/files/2IxZssb2EbpBR8JYkxhw" alt=""><figcaption></figcaption></figure>

1. **Get all cookies.** Defines whether to get one or all cookies
2. **Use JSON format.** Settings such as URL, Name, Path and Domain can be written in json format instead of a separate entry in the menu.
3. **URL.** The URL with which the cookie to retrieve is associated. This field is optional when you turn on "Get all cookies"
4. **Name.** The name of the cookies to get
5. **Path.** The path of the cookies
6. **Domain.** Domain to which cookies should be linked (with this exact domain or one of its sub-domains)

* **Set a cookie.** In this mode, the block sets cookies. Below is a screenshot with the settings of this mode.

<figure><img src="/files/5nsA8WaJuiyCFrB77NYq" alt=""><figcaption></figcaption></figure>

1. **Use JSON format.** Similar to the previous mode, it allows you to record all the mode settings in json format.
2. **URL.** Defines the request URI to be assigned to the cookie. This value may affect the domain and path values of the created cookie.
3. **Name.** The name of the cookie
4. **Path.** The path of the cookies
5. **Value.** The value of the cookies
6. **Domain.** This is the domain of the cookie.
7. **sameSite.** This is the value that indicates the SameSite state of the cookie. Probable values: lax, strict, or you can keep it empty.
8. **expirationDate.** The cookie expires according to the number of seconds.

* **Remove cookies.** In this mode, the block deletes cookies. Here you need to specify the information in the URL, Name, Path settings. This data can also be specified in json format using the Use JSON format setting.


# Web Interaction


# Click Element Block

<figure><img src="/files/HOxtUGJBtE7pDquXohAQ" alt=""><figcaption></figcaption></figure>

This block simulates a mouse click on an element, which triggers an event associated with this click.

Please note:

This block cannot function without an active tab. For this reason, use the Active Tab block or the New Tab block before using this one.

<figure><img src="/files/7VO4Gh9qe4NZYNww26AE" alt=""><figcaption></figcaption></figure>

Below is a screenshot of the block settings:

<figure><img src="/files/fZ4jzqXsyvzuUQwDNw8c" alt=""><figcaption></figcaption></figure>

The block supports two modes: CSS Selector and XPath. For the block to work correctly, you need to enter the element selector in the Element selector input field. To get an element selector, you can use the Element selector tool of the Goless extension. Below is a screenshot of the extension:

<figure><img src="/files/KrEa1D2QvLKqO482Yy8y" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/udyuDYJRpkTYb7IAxCB6" alt=""><figcaption></figcaption></figure>

After opening the Element selector component on the site page, to get the selector of the html page element, you just need to click on it with the mouse. The resulting selector must be entered in the selector input field of the Click element block.

Click element Block Settings:

* **Multiple.** Multiple element selection.
* **Mark element.** The item will not be selected if it was selected earlier.
* **Wait for selector.** Wait for the selector to be received. When you select this element, you can enter the timeout of the selector.


# Get Text Block

<figure><img src="/files/L0UIr8ssrbJtmLFS0q2T" alt=""><figcaption></figcaption></figure>

This block receives the text content of the element. To work correctly, you need to get the element selector and enter it in the appropriate field of the block.

Please note:

This block cannot function without an active tab. For this reason, use the Active Tab block or the New Tab block before using this one.

Below is a screenshot of the block settings:

<figure><img src="/files/pQzLcYASpVLtPM8fAOEH" alt=""><figcaption></figcaption></figure>

The block supports two modes: CSS Selector and XPath. For the block to work correctly, you need to enter the element selector in the Element selector input field. To get an element selector, you can use the Element selector tool of the Goless extension.&#x20;

* Settings of the **Selector options** group:
  1. **Multiple.** Multiple element selection.
  2. **Mark element.** The item will not be selected if it was selected earlier.
  3. **Wait for selector.** Wait for the selector to be received. When you select this element, you can enter the timeout of the selector.
* **Regex.** Match the fetched text to the regex.
* **Text prefix.** Adds a prefix to the received text. The resulting text will start with your character set.
* **Textsuffix.** Adds a suffix to the received text. The resulting text will end with your character set.
* **Include HTML tags.** Add the element's HTML markup inside the text.
* **Use `textContent.`** Get all the text from the element even if the text is not shown.
* **Assign to variable.** Assign text to a variable.
* **Insert to table.** Assign text to a table column. This setting is usually used in cycles where the rows of the internal workflow table are filled in sequentially.
* **Add extra row.** Adding the value to the selected column.

<figure><img src="/files/vsbMxXB2H3YNfSPluxEu" alt=""><figcaption></figcaption></figure>


# Scroll Element Block

<figure><img src="/files/276se2R6iiLG08LgC8xY" alt=""><figcaption></figcaption></figure>

This block scrolls the page element to the specified coordinates. A screenshot of the settings is shown below.

<figure><img src="/files/hgQLoefmHYVPWft8wErO" alt=""><figcaption></figcaption></figure>

Please note:

This block cannot function without an active tab. For this reason, use the Active Tab block or the New Tab block before using this one.

The block has two modes of operation: CSS Selector or XPatch. In the first mode, the block must receive a css selector of the page element for its operation. In the second mode, the block receives the Xpath of the element. To get a selector, you can use the Element selector tool of the Goless extension. You can also leave the html selector set by default to scroll through the open browser page.

* Settings of the **Selector options** group:

1. **Multiple.** Multiple element selection.
2. **Mark element.** The item will not be selected if it was selected earlier.
3. **Wait for selector.** Wait for the selector to be received. When you select this element, you can enter the timeout of the selector.

* **Scroll horizontal.** Scroll the page element horizontally to the X coordinate.
* **Scroll vertical.** Scroll the page element vertically to the Y coordinate.
* **Scroll into view.** Scroll down until the required item becomes visible in the window. This setting can be paired with the Smooth scroll setting.
* **Smooth scroll.** Turn on the smooth scrolling mode.
* **Increment horizontal scroll.** Add the X scroll coordinate of the matching element with the horizontal scroll you entered.
* **Increment vertical scroll.** Add the Y scroll coordinate of the matching element with the vertical scroll you entered.


# Link Block

<figure><img src="/files/T8X0HCZoN65RRcnEnMAB" alt=""><figcaption></figcaption></figure>

Open the URL with an [anchor](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) element (\<a>).

An anchor element may have the [target="\_blank"](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target) attribute. It will open a new tab when you click on it using the Click element block. GoLess won't execute the next block on a new tab because it opened a new tab.

To solve this problem, you must use the Link block. It will catch the anchor URL and open it in the same tab.

Note

This block will not work without an active tab. Because of that, use the Active Tab block or New Tab block before using this block.

A screenshot of the settings is located below:

<figure><img src="/files/1NUsaLT567LjumfMNyeu" alt=""><figcaption></figcaption></figure>

The block has two modes of operation: CSS Selector or XPatch. In the first mode, the block must receive a css selector of the page element for its operation. In the second mode, the block receives the Xpath of the element. To get a selector, you can use the Element selector tool of the Goless extension.&#x20;

* Settings of the **Selector options** group:

1. **Mark element.** The item will not be selected if it was selected earlier.
2. **Wait for selector.** Wait for the selector to be received. When you select this element, you can enter the timeout of the selector.

* **Open in new tab.** The setting allows you to open the URL in a new tab.


# Attribute Value Block

<figure><img src="/files/qud4X2IPY3m6aVDGEQOw" alt=""><figcaption></figcaption></figure>

This block gets or sets the value of the specified attribute from the element.

Note

This block will not work without an active tab. Because of that, use the Active Tab block or New Tab block before using this block.

Below is a screenshot of the block settings.

<figure><img src="/files/phQ2W9FOBq4UfambGXZ8" alt=""><figcaption></figcaption></figure>

The block has two modes of operation: CSS Selector or XPatch. In the first mode, the block must receive a css selector of the page element for its operation. In the second mode, the block receives the Xpath of the element. To get a selector, you can use the Element selector tool of the Goless extension.

* Settings of the **Selector options** group:

1. **Multiple.** Multiple element selection.
2. **Mark element.** The item will not be selected if it was selected earlier.
3. **Wait for selector.** Wait for the selector to be received. When you select this element, you can enter the timeout of the selector.

The Action setting has two modes:

* **Get attribute value.** Allows you to get the attribute value.
* **Set attribute value.** Allows you to record the value of an attribute.

Below is a screenshot of the Get attribute value mode:

<figure><img src="/files/MbEwAKnoH9oUJXZKKR4A" alt=""><figcaption></figcaption></figure>

Available Get attribute value mode settings:

* **Attribute name.** Here you need to enter the attribute name. You can get the name using the Element selector tool of the Goless extension.
* **Assign to variable.** The resulting attribute value is assigned to the variable you selected.
* **Insert to table.** The resulting attribute value is inserted into the column of the table you selected.
* **Add extra row.** An arbitrary row is added to the table in the column of the table you have selected.

Screenshot of the Set attribute value mode:

<figure><img src="/files/GfJY41l2VLfOhXIrVC9e" alt=""><figcaption></figcaption></figure>

Set attribute value mode settings:

* **Attribute name.** Here you need to enter the attribute name. You can get the name using the Element selector tool of the Goless extension.
* **Attribute value.** Here you need to enter the attribute value to set its value.

### **Getting the attribute name using the Element selector tool of the Goless extension.**

In the Goless extension, we will find a tool for obtaining the element selector of a site page element.

<figure><img src="/files/z9jVlh9IKT4ZaeeXsRfi" alt=""><figcaption></figcaption></figure>

Let's select a page element and get a selector. In the screenshot below, the attribute of the element selector is highlighted on the Attributes tab. The arrow points to the attribute value, the attribute name is signed in the upper left corner.

<figure><img src="/files/nQxq4RP6bFjWI71LjHKn" alt=""><figcaption></figcaption></figure>


# Forms Block

<figure><img src="/files/eggZEb8g4MU6iIDFiSNx" alt=""><figcaption></figcaption></figure>

This block receives or fills in the value of the form element (input, select, checkbox, and radio).

Please note:

This block cannot function without an active tab. For this reason, use the Active Tab block or the New Tab block before using this one.

Below is a screenshot of the block settings.

<figure><img src="/files/aQyO9ftJI6ZKZbsISA1K" alt=""><figcaption></figcaption></figure>

The block has two modes of operation: CSS Selector or XPatch. In the first mode, the block must receive a css selector of the page element for its operation. In the second mode, the block receives the Xpath of the element. To get a selector, you can use the Element selector tool of the Goless extension.

* Settings of the **Selector options** group:

1. **Multiple.** Multiple element selection.
2. **Mark element.** The item will not be selected if it was selected earlier.
3. **Wait for selector.** Wait for the selector to be received. When you select this element, you can enter the timeout of the selector.

If you need to get information from an element, select the **Get form value** setting.

### Get form value <a href="#get-form-value" id="get-form-value"></a>

<figure><img src="/files/iarCS1nW6hhj88xv6PFI" alt=""><figcaption></figcaption></figure>

Receive the value of the form element. After selecting a setting, two settings are available to save the received data:

* **Assign to variable.** Set the value of a variable or not.
* **Insert to table.** Assign a value to a table column. This setting is usually used in cycles where the rows of the internal workflow table are filled in sequentially.

### Form type <a href="#form-type" id="form-type"></a>

To get data from an html page element, select the element type in the Form type setting. A screenshot with configuration options is shown below:

<figure><img src="/files/JUXqm7L2EL1EZKWsULnP" alt=""><figcaption></figcaption></figure>

* **Text field.** A text field to fill in. Settings for this type:

1. **Value.** The value of a text field element such as  and , or an element with a contenteditable attribute.
2. **Clear form value.** This removes the value from the text field element before inserting the new one.
3. **Typing delay.** This adds a time limit when inserting each character of the value. When set to 0, it is inserted immediately.

* **Select.** A selection item from a list of values. Settings for this type:

1. **Value.** The value for the element. To select a specific option for a selection item, you can enter the value of the option you want to select into it. The parameter value can be found using the Element Selector tool or Chrome DevTools.

<figure><img src="/files/2HzCiBIyYtBxb97Hq0P4" alt=""><figcaption></figcaption></figure>

2. **First option.** Selecting the first value in the item list.
3. **Last option.** Selecting the last value in the item list.
4. **Custom.** Selecting a value in the list by index.

* &#x20; **Checkbox & Radio.** Select the checkbox or radio element or not.


# Javascript Code Block

<figure><img src="/files/s9QjP43dPgD817VRZy68" alt=""><figcaption></figcaption></figure>

This block executes javascript code on the site page.

Below is a screenshot of the block settings.

<figure><img src="/files/KUnEHTDs21CSuEYb7KAT" alt=""><figcaption></figcaption></figure>

There are two modes of operation of the block: **Active tab** and **Background**. The first mode works after opening the active tab using the New Tab or Active Tab blocks. The second mode works in the context of the browser in which the Goless workflow is running, an active browser tab is not required.

Block Settings:

* **Timeout.** Delay in executing javascript code, default value 20000ms (20 seconds). If the delay is exceeded, the workflow continues to run the next block.
* **Execute Every New Tab.** This will run the JS code when GoLess creates or switches to a new tab. If you enable this option, the JS code block will no longer need an active tab and built-in functions such as golessRefData, golessNextBlock.
* **Run before page loaded.** Executing the JS code before loading the page. This setting is only available in Active tab mode.
* **JavaScript code.** This is the field for entering the js code that is executed by the workflow.
* **Preload Script.** Load a javascript file before running the JS code.

### JavaScript Code <a href="#javascript-code" id="javascript-code"></a>

There are several integrated fuctions that you can call inside the code.

#### <mark style="color:red;">`golessNextBlock(data, insert?)`</mark> <a href="#automanextblock-data-insert" id="automanextblock-data-insert"></a>

Instructs the workflow to keep running the next block.

To insert data into the table, use the `data` parameter. This parameter can take an object or an array of object data types. You can define the key of the object in the table.

The `insert` parameter controls whether to insert the data in the data parameter into the table. Set to `true` by default. It is also possible to pass an object that contains two optional properties:

* `insert`: insert data into the table or not.
* `nextBlockId`: a string specifying the following block's ID to move to.

#### <mark style="color:red;">`golessSetVariable(name, value)`</mark> <a href="#automasetvariable-name-value" id="automasetvariable-name-value"></a>

Defines the value of the workflow variables.

```javascript
// Example of outputting a variable from the parameters of a Trigger block
const inputValues = golessRefData('variables', 'param');
console.log(inputValues);
golessNextBlock()
```

#### <mark style="color:red;">`golessRefData(keyword, path)`</mark> <a href="#automarefdata-keyword-path" id="automarefdata-keyword-path"></a>

Use it to access workflow data such as table, variables, etc.

#### <mark style="color:red;">`golessFetch(type, resource)`</mark> <a href="#automafetch-type-resource" id="automafetch-type-resource"></a>

Perform an HTTP request in the extension's background in order to prevent [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).

* `type`: type of the request answer. Possible values `text` & `json`;
* `resource`: the resource that you wish to retrieve.

#### <mark style="color:red;">`golessResetTimeout()`</mark> <a href="#automaresettimeout" id="automaresettimeout"></a>

Use this function to reset the runtime.


# Trigger Event Block

<figure><img src="/files/IA3jDmGajPH4AY3Aj8qQ" alt=""><figcaption></figcaption></figure>

This block activates the site page element event.

Please note:

This block cannot function without an active tab. For this reason, use the Active Tab block or the New Tab block before using this one.

Below is a screenshot of the block.

<figure><img src="/files/9bMjoZ5XMIskVUoYnc1m" alt=""><figcaption></figcaption></figure>

The block has two modes of operation: CSS Selector or XPatch. In the first mode, the block must receive a css selector of the page element for its operation. In the second mode, the block receives the Xpath of the element. To get a selector, you can use the Element selector tool of the Goless extension.

* Settings of the **Selector options** group:

1. **Multiple.** Multiple element selection.
2. **Mark element.** The item will not be selected if it was selected earlier.
3. **Wait for selector.** Wait for the selector to be received. When you select this element, you can enter the timeout of the selector.

* Select event. The event that you want to activate. There are 21 events available for selection:

1. **Click.** The element receives a click event when the button of the pointing device (for example, the main mouse button) is simultaneously pressed and released while the pointer is inside the element.
2. **Double Click.** The ondblclick event occurs when a pointing device button (for example, the main mouse button) is double-clicked; that is, when it double-clicks one element quickly for a very short period of time.
3. **Mouseup.** The mouseup event occurs when a button on a pointing device (such as a mouse or trackpad) is released when the pointer is inside it.
4. **Mousedown.** The mousedown event occurs when the pointing device button is pressed when the pointer is inside the element.
5. **Mouseenter.** The mouseenter event is generated when the pointing device (usually the mouse) is initially moved so that its active point is inside the element for which the event was triggered.
6. **Mouseleave.** The mouseleave event occurs when the cursor of a pointing device (usually a mouse) is output from it.
7. **Mouse over.** The mouseover event occurs when a pointing device (such as a mouse or trackpad) is used to move the cursor to an element or one of its child elements.
8. **Mouseout.** The mouseout event occurs when a pointing device (usually a mouse) is used to move the cursor so that it is no longer contained inside an element or one of its child elements.
9. **Mousemove.** The mousemove event is called for an element when a pointing device (usually a mouse) is moved when the active cursor point is inside it.
10. **Focus.** The focus event is triggered when the element has received focus.
11. **Blur.** The blur event is triggered when the element loses focus.
12. **InputEvent.** An InputEvent is an event that notifies the user of changes to the edited content.
13. **Change.** The change event is called for  \<input> elements, \<select> and \<textarea> when the user changes the value of the element. Unlike the input event, the change event does not necessarily trigger every time the value of an element changes.
14. **Touchstart.** The touchstart event is generated when one or more touch points are placed on the touch surface.
15. **Touched.** The touchend event occurs when one or more touch points are removed from the touch surface.
16. **Touchmove.** The touchmove event occurs when one or more touch points move across the touch surface.
17. **Touchcancel.** The touchcancel event occurs when one or more interaction points have been violated depending on the implementation (for example, too many interaction points have been created).
18. **Keydown.** The keydown event is triggered when a key is pressed.
19. **Keyup.** The keyup event is triggered when the key is released.
20. **Submit.** The submit event is triggered when sending  \<form>. Note that the submit event is triggered on the element \<form>, and not on any \<button> or \<input type="submit"> inside it. However, the submit event, which is sent to indicate that the form submission action has been started, includes the submitter property, which is the button that was called to trigger the submission request.
21. **Wheel.** The wheel event occurs when the user turns the wheel button on a pointing device (usually a mouse).

General settings of the options group:

* **Bubbles.** The bubbles property of the event indicates whether the event passes through the DOM tree or not.
* **Cancelable.** The read-only cancelable property of an event indicates whether the event can be canceled and therefore prevented, as if the event never occurred.


# Switch Frame Block

Toggle between the main window and the iframe element.

Use this block when you wish to run the blocks in the category of web interaction within an iframe element or when you want to swap back to the main window.

* **Iframe selector**\
  CSS Selector of the iframe element.

Please note:

This block cannot function without an active tab. For this reason, use the Active Tab block or the New Tab block before using this one.


# Upload File Block

Upload file into an `<input type="file">` element.

* **Element selector**\
  Selector for the `<input type="file">` element.
* **File path**\
  The absolute path, the URL, or the base64 of the file you want to upload.

### Requirements <a href="#requirements" id="requirements"></a>

You must turn on the "Allow access to file URLs" option to enable this block to work.

* Open `chrome://extensions`
* Find GoLess and click the "Detail" button
* Scroll down and turn on "Allow access to file URLs"

### Find the Upload File Selector <a href="#find-the-upload-file-selector" id="find-the-upload-file-selector"></a>

Usually, the element for uploading the file is obscured. Therefore, you can use the Element Picker to select it and use the Recording feature to find the upload file element.

1. Start to record
2. Upload a file and stop recording
3. Clean the other blocks, such as the click element, which causes the website to open a file selector window. It is not required when using the upload file block.

Please note:

This block cannot function without an active tab. For this reason, use the Active Tab block or the New Tab block before using this one.


# Hover Element Block

Hovers over an element.

* **Element selector**

Please note:

This block cannot function without an active tab. For this reason, use the Active Tab block or the New Tab block before using this one.


# Save Assets Block

Save such resources as pictures, video, audio, or files from an element or URL.

* **Type**\
  Indicates where to get the assets: from a URL or elements like pictures, audio, or video.
* **URL**\
  URL of the resource. For instance, `https://example.com/image.png`
* **Element selector**
* **File name**\
  The filename for the resource. Leave the input blank if you don't want to rename the resource.
* **On conflict**\
  Specifies what to do if there is a conflict between an asset file name and an existing one.
  * `"uniquify"`\
    The browser will change the filename to make it unique.
  * `"overwrite"`\
    The browser will replace the previous file by the newly-downloaded file.
  * `"prompt"`\
    The browser will ask the user whether to uniquify or overwrite.
* **Save items' download ids**\
  Save the download IDs of the downloaded resources into a variable or the workflow table. It returns an array of integers.

  You can pass this download ID to the Handle Download block if you wish to retrieve the file path of the downloaded resource.

Please note:

This block cannot function without an active tab. For this reason, use the Active Tab block or the New Tab block before using this one.


# Press Key Block

Simulate the keystroke or it's combo on the page.

* **Target element**\
  The element in which you want to simulate the keystroke.
* **Key**\
  The key or a combination that you want to simulate.

Please note:

This block only emulates pushing the key on the website. This means it can't activate browser shortcuts, such as opening or closing a new tab, or system shortcuts, such as copy-paste.

Please note:

This block cannot function without an active tab. For this reason, use the Active Tab block or the New Tab block before using this one.


# Create Element Block

This block creates an element and inserts it into the webpage.

* **Element selector**\
  The element selector of the specific element.
* **Insert element**\
  Represent the position of the specific element.
  * **As first child**\
    Insert it as the first child of the specific element.
  * **As last child**\
    Insert it as the last child of the specific element.
  * **As previous sibling**\
    Insert it as the previous sibling of the specific element.
  * **As next sibling**\
    Insert it as the next sibling of the specific element.
  * **Replace target element**\
    Substitue the specific element for the element that was created.
* **HTML**\
  The HTML code of the element you would like to create.
* **CSS**\
  The CSS code that will be injected into the webpage
* **JavaScript**\
  The JS that will be injected into the webpage
  * <mark style="color:red;">**`golessRefData(keyword, path?)`**</mark><mark style="color:red;">\*\* \*\*</mark><mark style="color:red;">**function**</mark>\
    Use this function for referencing data.\
    For further information, open the Javascript Block page.
  * <mark style="color:red;">**`golessExecWorkflow(detail)`**</mark><mark style="color:red;">\*\* \*\*</mark><mark style="color:red;">**function**</mark>\
    Workflow execution functionality.\
    The `detail` parameter is where you input the detail of the workflow like the ID or `publicId` of the workflow you want to run.
* **Preload script**\
  Load scripts or styles before injecting the element.

Please note:

This block cannot function without an active tab. For this reason, use the Active Tab block or the New Tab block before using this one.


# Control Flow


# Repeat Task Block

Reiterate over one or multiple blocks

Connect the second output (`Repeat from`) to the block from which you want to repeat.

When you run the workflow and reach the repeat task block, the workflow will start to run again from the block that connects to the second output. You may set the number of times it is repeated in the input provided.


# Conditions Block

Include conditional logic in the workflow.

When this block runs, it checks for any conditions you have created.

When this block runs, it will check every condition you have built. If the condition is met, the workflow continues to the block that connects to the condition output. If there is no match, the workflow will continue to the block connected with the `fallback`output.

Open the Condition Builder page to find out how to create a condition.

\
\\


# Element Exists Block

Check the document to see if an element exists.

If there is an element, the workflow will run the block that connects with the first output. Otherwise, it will run the `fallback` output.

* **Element selector**
* **Try for**\
  Set how often to check the element according to the selector.
* **Timeout**\
  By default, the delay is 500ms.
* **Fallback**\
  A fallback when the element is not present.
* **Throw an error if doesn't exist**\
  Initiate an error rather than perform the fallback.


# While Loop Block

Run blocks when condition has been met.

Once the condition is met, the while loop block continues to the block which connects to the first output. If it's not met, it continues to the block that connects with the fallback output.

Go to the Condition Builder page to learn how to make a condition.

\
\\


# Loop Data Block

Use this block when you want to make a loop across the data.

### Loop Through <a href="#loop-through" id="loop-through"></a>

Select the data that you want to loop. Available options: table, numbers, Google Sheets, elements, variables, or custom date.

Make sure you write [array](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Arrays) data type with [JSON](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON) syntax when using the custom data option!

When you select the `elements` options, GoLess will return an array of selectors of the elements that match the `selector` you entered so that you can use the loop data block.

### Loop ID <a href="#loop-id" id="loop-id"></a>

Identification of the loop. Use this ID when accessing loop data in expressions or while using the Loop Breakpoint block.

### Max data <a href="#max-data" id="max-data"></a>

Specify the data limit in a loop.


# Loop Elements Block

Use this to iterate through elements that match the selector. This block is the same as the loop block with the "Elements" option but has more functionality.

* **Loop Id**\
  Identification of the loop. Use this ID to reference loop data or while using the loop breakpoint block.
* **Element Selector**\
  Element selector of elements for looping.
* **Max data**\
  Define the limit for loop elements.
* **Load more elements**\
  A special action to load more elements
  * **None**
  * **Click an element to load more**
  * **Click a link to load more**
  * **Scroll down to load more**


# Loop Breakpoint

Define the loopback data block breakpoint. You need to enter the loop data block's loop ID when using that block.

### Stop Loop <a href="#stop-loop" id="stop-loop"></a>

It will stop the loop corresponding to the loop identifier you are entering and continue the execution until the next block.


# Data


# Insert Data Block

This inserts extra data into the variables or table.

### Import file <a href="#import-file" id="import-file"></a>

Put the contents of the file in a variable or the table column. You need to allow GoLess to access the file URLs to use this functionality.

1. Open `chrome://extensions`
2. Find GoLess and click **"Details"**
3. Scroll down and turn on **"Allow access to file URLs"**

You can type the absolute path of the file or the file's URL in the value text field:

* Absolute Path
  * Windows: `C:\Users\Public\Documents\test.docx`
  * MacOS: `/Users/Josh/Desktop/documents.pdf`
* URL
  * `https://example.com/files/file.pdf`
  * `https://example.com/list.txt`

\
\\


# Delete Data Block

Remove variable data or table

* **Data from**\
  Select which data to delete
* **Select column**\
  Delete all columns or only one particular column
* **Variable**\
  Variable name that will be deleted

\
\\


# Get Log Data Block

Retrieve variables and a table from the workflow logs.

* **Select workflow**\
  Select the workflow where to get logs
* **Assign to variable**\
  Assign the log data into a variable or not
* **Variable name**\
  Variable name used to assign log data
* **Insert to table**\
  Insert the log data into the table or not
* **Select column**\
  The column where to insert the log information

\
\\


# Slice Variable Block

Extracts a section with a variable value.

* **Variable name**\
  The name of the variable
* **Start index**\
  The zero-based index to begin extraction. When the start index is negative, GoLess starts extracting from the end of the value.
* **End index**\
  The index of the first element that should be excluded.


# Increase Variable Block

Increase the variable's value per specified amount.

* **Variable name**\
  The name of the variable
* **Increase by**\
  Specify the increment for the variable value. The variable's value will decrease if you type in a negative figure.


# RegEx Variable Block

Match one variable to one [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions).

* **Variable name**\
  The name of the variable
* **RegEx**\
  The regular expression will be used to match the variable's value. For instance, if you use `\d+` with this expression, GoLess will return only the digits inside the variable value


# Data Mapping Block

Map data of a table or variable.

* **Data source**\
  The data source for mapping may be a variable or a table
* **Data map**\
  The data map is where you match the source fields with the destination fields by inputting the dot notation. The source may have several destinations.
* **Assign to variable**\
  Assign mapped data into a variable or not.
* **Variable name**\
  Variable name to assign mapped data.
* **Insert to table**\
  Insert mapped data into the table or not.
* **Select column**\
  The column in which the mapped data will be inserted.


# Sort Data Block

Sort through the data items.

* **Data source**\
  The data source for mapping may be a table or a variable.
* **Sort by the item's property**\
  Sort the item by its property.
* **Assign to variable**\
  Assign the sorted data into a variable or not.
* **Variable name**\
  Name of the variable to assign the sorted data.
* **Insert to table**\
  Insert the sorted data into the table or not.
* **Select column**\
  Column to insert sorted data.


# Оnline Services


# Google Sheets Block

This integration allows you to read or write data from a Google Sheets spreadsheet.

### Granting Access to the Spreadsheet

Before using this integration, you need to give access to the GoLess service. You can do this in two ways:

1. Share the spreadsheet publicly, but note that GoLess will only have read access.
2. Share the spreadsheet with the GoLess service account by clicking the share button on the top right of the spreadsheet and entering <mark style="color:orange;">`goless@goless.iam.gserviceaccount.com`</mark>.\\

<figure><img src="/files/rRnTKABACYSIQQLJ22lw" alt=""><figcaption></figcaption></figure>

### Spreadsheet ID

The Spreadsheet ID is a string of letters, numbers, hyphens, or underscores. You can find it in the Google Sheets URL.

`https://docs.google.com/spreadsheets/d/`<mark style="color:green;">`1CyccvSsq0VdujNThPKr3l8ipLQfQo9KuzTpJxpwTPyg`</mark>`/edit#gid=0`

<figure><img src="/files/jqhjnXge86So7YnCJNiR" alt=""><figcaption></figcaption></figure>

### Cell Range

The cell range is the range of the cells that you want to get or update. You can define the range using either the [A1 notation](https://developers.google.com/sheets/api/guides/concepts#expandable-1) like `Sheet1!A1:B2` or [R1C1 notation](https://developers.google.com/sheets/api/guides/concepts#expandable-2) like `Sheet1!R1C1:R2C2`.

### Reading Spreadsheet Values

You can get the values of the cells in the spreadsheet.

* **Reference key** The key for identifying the Google Sheets data.
* **Use the first row as keys** Use the first row of the spreadsheet as the object key. For example, if you have a spreadsheet like this:

| name | age |
| ---- | --- |
| foo  | 22  |
| bar  | 23  |

```json
// option disabled
[["name", "age"], ["foo", 22], ["bar", 23]]

// option enabled
[{ "name": "foo", "age": 22 }, { "name": "bar", "age": 23 }]
```

#### Accessing Spreadsheet Data

To access the spreadsheet values from an input of a block, you can use expressions like `{{ googleSheets.referenceKey.path }}` syntax.

Read more: [Expressions](/workflow/expressions#writing-expression)

### Updating Spreadsheet Values

You can update the values of the cells in the spreadsheet.

* **Value input option** Determines how input data should be interpreted, defaulting to `RAW`.

| Value          | Description                                                                                                                                                                                                                                            |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `RAW`          | The values the user has entered will not be parsed and will be stored as-is                                                                                                                                                                            |
| `USER_ENTERED` | The values will be parsed as if the user typed them into the UI. Numbers will stay as numbers, but strings may be converted to numbers, dates, etc. following the same rules that are applied when entering text into a cell via the Google Sheets UI. |

Read more on the [Google developer page](https://developers.google.com/sheets/api/reference/rest/v4/ValueInputOption)

* **Data source** The source of the data for updating the spreadsheet defaults to a [table](/workflow/workflow-table). When using the custom option, the input data must be an array of arrays with valid JSON syntax.

**Example**

```json
[["name", "age"], ["foo", 22], ["bar", 23, "text"]]
```

* **Use keys as the first row** Use the columns as the first row on the spreadsheet.


# Premium


# ChatGPT Block

<figure><img src="/files/owHE1j1KiPSEmuB3ey5Q" alt=""><figcaption></figcaption></figure>

To use the chatGPT block in your workflow, you must purchase a [subscription](https://goless.com/pricing).

When inserting the chatGPT block into the workflow, you must choose the AI version that best suits your purposes (only version 3.5 turbo is available for now).

<figure><img src="/files/J9Fdy40pL1JSrQpjWeEm" alt="" width="321"><figcaption></figcaption></figure>

For further use in our example, set the [Get text](https://docs.goless.com/blocks/web-interaction/get-text-block) block before the chatGPT block to send text to the chatGPT block.

In the [Get text](https://docs.goless.com/blocks/web-interaction/get-text-block) block, set the parameters of the text you want to pass to the chatGPT block, and store the data in a [variable](https://docs.goless.com/workflow/variables).

<figure><img src="/files/ldkRTl8SK9nW9TtM3YZ3" alt="" width="321"><figcaption></figcaption></figure>

Next, use a [variable](https://docs.goless.com/workflow/variables) from the [Get text](https://docs.goless.com/blocks/web-interaction/get-text-block) block and pass it to chatGPT and add an explanation of what the neural network should do with the text it received from the variable: e.g. "Rewrite: {{ globalData.key }}".

<figure><img src="/files/68n4BJ11rk1bBiu8u7CP" alt="" width="316"><figcaption></figcaption></figure>

Next, you need to save the chatGPT response in a [variable](https://docs.goless.com/workflow/variables) and pass it to the next [Forms](https://docs.goless.com/blocks/web-interaction/forms-block) block.

{% hint style="info" %}
Example: the data transfer will take place in the [Forms](https://docs.goless.com/blocks/web-interaction/forms-block) block, but you can use any block that can accept parameters.
{% endhint %}

<figure><img src="/files/P6t1QibW3zlslYs1oK1W" alt="" width="563"><figcaption></figcaption></figure>

In the [Forms ](https://docs.goless.com/blocks/web-interaction/forms-block)block you need to pass the data via a [variable](https://docs.goless.com/workflow/variables) from chatGPT and insert it into the desired form, in your workflow.

<figure><img src="/files/rMdXEEWOG623ak1G791z" alt="" width="325"><figcaption></figcaption></figure>


# Captcha Block

<figure><img src="/files/GkBi35xF1vc2fLFIGkMs" alt=""><figcaption></figcaption></figure>

The captcha block solves the captcha on the page of the required site. Before using this block, use the New Tab block or the Active Tab block.

The screenshot below shows the standard algorithm for using the block.

<figure><img src="/files/76asEUcHhU33oJ5XZtA3" alt=""><figcaption></figcaption></figure>

After the block is completed, the result is recorded in a text field that is embedded in the site page.\
![](/files/xDDVkBgaX3gAPc1qBRza)

The block has no settings and works in test mode.


# Logs

Recent workflow logs.


# Schedule

The "Schedule" section describes how you can trigger a workflow using the Trigger Block, which is the starting point for workflow execution.


# Storage

Storage is intended for storing the data of variables and tables. The data stored here shall be **retained**.

### Tables <a href="#tables" id="tables"></a>

Click on the "[Add Table](/workflow/workflow-table)" button to add a table to storage. Then set the name and columns of the table.

![](/files/AK6W7ahsH4DWXHE8xKNa)

And to use this table in a workflow, open the workflow table and click the "connect to a storage table" button.

To learn more about the table, check out the [Table page](/workflow/workflow-table).

![](/files/XG4K8gYCVUloM3sVjUtS)

### Variables <a href="#variables" id="variables"></a>

You may add a variable from the workflow or the variables page in the storage. The variable name should begin with a double dollar (`$$`) sign whenever you want to read or assign a variable's value. It's necessary to differentiate between the workflow variable and the storage variable. E.g., when you add or update a variable from a block.

To learn more about variables, check out the [variable page](/workflow/variables).

![](/files/gDSzVlKNysFAF2gt4ccO) ![](/files/ceZW6PyXLbU2VvTAgWcs)

### Credentials <a href="#credentials" id="credentials"></a>

This is used to keep credentials. The login information stored here will be encrypted. It means you cannot see or modify them after adding them.

Use the secret keywords inside the mustache tag to access these credentials in a workflow. E.g., `{{ secrets@credentialName }}`


# Packages

Packages (formerly known as block folders) are intended to wrap one or several blocks to make them reusable. E.g., if you have blocks for some operation and want to use them in a different workflow, you can make a package with these blocks instead of copy-pasting them.

### Creating a package <a href="#creating-a-package" id="creating-a-package"></a>

There are two ways of making a package:

#### From Workflow Editor <a href="#from-workflow-editor" id="from-workflow-editor"></a>

To make a package from a workflow editor, select blocks first. You can select a block by pressing shift and dragging the mouse to the blocks you want to select. Next, right-click and choose "Set as package".

#### From Package Page <a href="#from-package-page" id="from-package-page"></a>

To make a package from a package page, browse to the packages page, choose "New package" and enter the name and description of the package.

### Editing a Package <a href="#editing-a-package" id="editing-a-package"></a>

To edit a package, open the packages page and choose the package you want to edit. It is the same manner you edit a workflow. The difference is that a package doesn't have the table and global data.

#### Set Package as Block <a href="#set-package-as-block" id="set-package-as-block"></a>

If you set the package as a block, it will only be treated as a block in a workflow. Proceed to the settings tab when editing a package to enable this option.

**Block Inputs & Outputs**

Right-click on a block input/output of the package to define the inputs/outputs of the block. Then select to set it as the package block input or output.

You'll see the inputs/outputs of the package block when using it in a workflow.

When you connect a block to one of the package block inputs, GoLess will start to run from the block you set as the input in the package.


# Condition Builder

You can use condition builders to create condition statements within your workflow. For example, you can use it to control the flow using the While Loop or Conditions block. Also, you can add a condition button by clicking "Add condition".

### Value <a href="#value" id="value"></a>

#### Value <a href="#value-1" id="value-1"></a>

You can write expressions within the text field for the value you want to compare.

**Value prefix**

This prefix is a convention that serves to specify the data type of a value. You can use it to convert a value to the corresponding data type. For instance, you can use the "string::" prefix to convert a value to a string type and "number::" to convert a value to a numeric type.

Available prefix:

* `string::`: converts the value to a string.
* `json::`: converts the value to a JSON.
* `number::`: converts the value to a digit.
* `boolean::`: converts the value to a boolean.

#### Code <a href="#code" id="code"></a>

JavaScript expressions.

#### Data Exists <a href="#data-exists" id="data-exists"></a>

This checks if workflow data exists (table, variables, etc). E.g., checks variable name: `variables.name` or `variables@name`


# Workflow Common Errors

Here we explain a few common errors happening when executing a workflow and how to resolve them.

### Can't find an element with "{selector}" selector <a href="#element-not-found" id="element-not-found"></a>

This error occurs when the element selector does not match any element on the page. You can use the Element Exist block to check if the elements exist on the page. Or you can go to the element selector options and turn on "Wait for selector".

### Can't find a tab with "{pattern}" patterns [#](https://docs.automa.site/reference/javascript-execution-context.html#no-match-tab) <a href="#no-match-tab" id="no-match-tab"></a>

The Match Patterns you input do not match with any URLs tab. You can learn about writing match patterns on the MDN page.

### Content body is not valid JSON [#](https://docs.automa.site/reference/javascript-execution-context.html#invalid-body) <a href="#invalid-body" id="invalid-body"></a>

The request body in the HTTP Request block is not in the JSON format.

You may follow this guidance if you try to refer to the data in the body.

### Can't connect to a tab, use "New tab" or "Active tab" block before using the "{name}" block. [#](https://docs.automa.site/reference/javascript-execution-context.html#no-tab) <a href="#no-tab" id="no-tab"></a>

This occurs because the block you are trying to use requires an active tab to operate. An active tab in this situation is a tab in which the block will execute.

To fix this, you can use a New Tab block or an Active Tab block before the block you try to use.

### "{url}" is invalid URL [#](https://docs.automa.site/reference/javascript-execution-context.html#invalid-active-tab) <a href="#invalid-active-tab" id="invalid-active-tab"></a>

This error happens if the value you enter is not a valid URL. Valid URLs must begin with HTTP or HTTPs such as "<https://example.com>".


# JavaScript Execution Context

Execution context refers to the environment in which the JavaScript code will be run. In GoLess, you can choose between two environments Active Tab and Background.

### Active Tab <a href="#active-tab" id="active-tab"></a>

The workflow will insert the JS code in the active tab of the workflow. You can select this environment if you want to perform DOM manipulation or if you want to get the attribute or text from an element. However, keep in mind that it's not allowed to inject JS code for some websites because of Content Security Policy (CSP). It prevents the injection of 3rd party code. You can open the Chrome Dev Tools by pressing ctrl+shift+i; in the console tab and paste the following code to check if 3rd party code is allowed:

js

```
const script = document.createElement('script');
script.textContent = 'alert("Hello world!")';
document.body.appendChild(script);
```

If you see the following error, then 3rd party code can not be injected: `Refused to execute inline script because it violates the following Content Security Policy directive...`

### Background <a href="#background" id="background"></a>

The workflow will run your JS in a sandbox. So you can select this environment as the execution context if your code doesn't do anything related to DOM. Also, it doesn't require an active tab to work.

If you want to debug (for example, using the `console.log` method), you can find the output by opening the Chrome Devtools in the GoLess dashboard.


