# <H1 align="center">WORK WITH THE BROWSER</h1> 

<p> The «Work with the browser» module is based on the Selenium WebDriver  and allows implementing basic elements with working with a browser page – open tab, пgo to the tab, find the element on the page by its key and process it.</p>

## Module interface
<p> The module window is divided into the part of creating a command for working with a browser, a group of action control buttons and a table containing a list of created commands. Part of creating a command consists of several fields to fill out,  and the number of these fields varies depending on the selected action in the «Action» field. The group of buttons consists of the following buttons – «Add», «Edit» and «Delete».
<H1 align="center">![Screenshot](img/WB_1.png)</h1> 
<p> Creating a command starts with selecting an action. After selecting it, the list of available fields in the window may change. You need to fill out the fields that are required for the action to work and click «Add». The created action is gonna be listed in the  «Action list» table. To edit a command you need to select it in the list, edit the desired fields and then press the «Edit» button. But if you press the «Add» button, a new action is gonna be added but with the changes you made while editing. You can simply not change anything and click  «Add», then the command is gonna be copied. 
<p> To delete actions you need to select it in the list and press  the «Delete» button.
<p> You can change the order of the commands by pressing the arrow keys that are located in the top right corner. It's really simple to do, first select the row tje position of which you wanna change, then click the arrow keys to move it.
<H1 align="center">![Screenshot](img/WB_2.png)</h1> 
<p> For all actions these three fields never change «Driver», «Action» and  «Note». 
<p> The «Driver» field  is currently unavailable for editing and the default driver for the Chrome browser is selected in it, but in the future it is planned to supplement this list with other browsers.
<p> The «Action» field — is a drop-down list with all possible actions for this module. More detailed review of them is gonna be in the next chapter. 
<p> The «Note» field — a row with a note for the command.
## Description of actions
<p> Module offers 7 main actions  – go to the page, reload the page, go back and forward, work with the page, work with tabs, and close the browser. Each action requires filling in some kind of fields 
<p> Please note that it is advisable to close the browser opened using this module, too, otherwise, if you close the browser yourself and then try to continue working with it using this module, an error will occur and you will have to restart the program.
### Go to 
<p> Action goes to the specified page. The «URL» field is added. 
<H1 align="center">![Screenshot](img/WB_3.png)</h1> 
<p> If any page is already open, then it will go from it to the specified one, meaning that the original page will be replaced with a new one. If the browser has not yet been launched, it will be opened with this page.
### Reload the page
<p> Action reloads the already opened page, before using the action make sure the page is opened.
### Go back
<p> Goes to the page that was open before the current one.
### Go forward
<p> Goes to the page that was opened after the current one.
### Working with a page 
<p> This action provides the ability to work with a specific item of the page. The following fields will appear when configuring the action  – «Item search type», «Search line», «Page action», «Variable», «Waiting (sec)» и «Item number».
<H1 align="center">![Screenshot](img/WB_4.png)</h1> 
<p> The «Item search type» field is a drop-down list with a list of search methods for the element on the page, it is used in conjunction with the  «Search line» field. Below will be listed all types of searches for an element with examples of filling the  «Search line» field:
<p> •	GetElementsByName – search for elements by their name property.
<H1 align="center">![Screenshot](img/WB_5.png)</h1>
<p> •	GetElementsById – search for elements by their id property.
<H1 align="center">![Screenshot](img/WB_6.png)</h1>
<p> •	GetElementsByClass – search for elements by their class property.
<H1 align="center">![Screenshot](img/WB_7.png)</h1>
<p> •	GetElementsByCssSelector – search for elements by their css property. 
<H1 align="center">![Screenshot](img/WB_8.png)</h1>
<p> •	GetElementByLinkText – search for link elements in text. Only items with a complete match are searched.
<H1 align="center">![Screenshot](img/WB_9.png)</h1>
<p> •	GetElementsByPartialLinkText - search for link elements by their text. All items containing the given line are searched.
<H1 align="center">![Screenshot](img/WB_10.png)</h1>
<p> •	GetElementsByTagName – search for elements by their tag.
<H1 align="center">![Screenshot](img/WB_11.png)</h1>
<p> •	GetElementsByXPath – search for elements by HTML – xpath query language.
<H1 align="center">![Screenshot](img/WB_12.png)</h1>
<p> The «Page action» field offers a selection of an action from the drop-down list that must be performed on the found elements. The following actions are suggested:
<p> ●	Record – enters specified text into the «Variable» field (for example, after clicking on a specific element to enter text);
<p> ●	Get text - gets the value of the text properties of all found or specifically selected elements and returns the result as a list to the variable;
<p> ●	Send - press ENTER - use the recorded data (for example, any text can be entered with actions «Record», and then «Send» it);
<p> ●	Click – left-click on a specified element (filling out the «Item number» field is required);
<p> ●	Hover over a cursor – hovers over a specific element(filling out the «Item number» field is required);
<p> ●	Get Property – when choosing an action the «Property name» field appears - returns the value of the specified in the «Property name» field property of all found elements or the specified as a list into the variable;
<p> ●	Get CSS property – when choosing an action the «CSS property» field appears - returns the value of the specified in the «CSS property» field property of all found elements or the specified as a list into the variable;
<p> ●	Get Attribute – when choosing an action the «Attribute property» field appears - returns the value of the specified in the «Attribute property» field property of all found elements or the specified as a list into the variable;
<p> In the «Variable» field the name of a variable is entered starting with «@», in which the result of the executed command is gonna be put in, or otherwise from which the values for executing a command are gonna be taken from. 
<p> The «Waiting (sec)» field – the amount of seconds robot needs to wait after executing a command. 
<p> The «Item number» field – one index of the found item to which the action must be applied
<p> An example of the filled out action:
<H1 align="center">![Screenshot](img/WB_13.png)</h1>
<p> Here, the element with the name «q» is searched and the text «search» is put in it.
### Work with tabs
<p> This action allows manipulating with tabs in the browser window. For configuring at least one field is added – «Action», and other fields appear after you select the action.
<H1 align="center">![Screenshot](img/WB_14.png)</h1>
<p> Available actions for working with tabs - add, close, go to the tab and get tab amount. More detailed description of them:
<p> ●	Add tab - adds a new tab, the tab automatically becomes active; 
<p> ●	Close tab - closes the active tab;
<p> ●	Go to the tab – when choosing this action the «Tab number» field will appear - goes to the tab the number of which is specified in the «Tab number» field (starting with 0);
<p> ●	Get tab amount –when choosing this action the «Variable» field will appear - returns the amount of tabs into the specified  variable. 
### Close browser
<p> Closes the browser. 

