89 lines
1.4 KiB
Markdown
89 lines
1.4 KiB
Markdown
|
# Locator
|
||
|
|
||
|
_Helps locating elements in simple HTML pages_
|
||
|
|
||
|
## Installation
|
||
|
|
||
|
Either install it globally:
|
||
|
|
||
|
```sh
|
||
|
npm install --global git://gitea.tforgione.fr/tforgione/locator
|
||
|
```
|
||
|
|
||
|
or simply clone the repo:
|
||
|
|
||
|
```sh
|
||
|
git clone https://gitea.tforgione.fr/tforgione/locator
|
||
|
cd locator
|
||
|
npm install
|
||
|
```
|
||
|
|
||
|
## Usage
|
||
|
|
||
|
If you installed globally:
|
||
|
|
||
|
```sh
|
||
|
locator <path-to-the-HTML-file>
|
||
|
```
|
||
|
|
||
|
If you installed locally, in the directory where the `index.js` file is:
|
||
|
|
||
|
```sh
|
||
|
node index.js <path-to-the-HTML-file>
|
||
|
```
|
||
|
|
||
|
## Example
|
||
|
|
||
|
```sh
|
||
|
locator 10.html
|
||
|
```
|
||
|
|
||
|
Output:
|
||
|
|
||
|
```json
|
||
|
[
|
||
|
{
|
||
|
"x": 0.0546875,
|
||
|
"y": 0.09722222222222222,
|
||
|
"width": 0.890625,
|
||
|
"height": 0.11812065972222222,
|
||
|
"type": "h1"
|
||
|
},
|
||
|
{
|
||
|
"x": 0.0546875,
|
||
|
"y": 0.26395399305555556,
|
||
|
"width": 0.890625,
|
||
|
"height": 0.065625,
|
||
|
"type": "p"
|
||
|
},
|
||
|
{
|
||
|
"x": 0.0546875,
|
||
|
"y": 0.37819010416666665,
|
||
|
"width": 0.890625,
|
||
|
"height": 0.22604166666666667,
|
||
|
"type": "ul"
|
||
|
},
|
||
|
{
|
||
|
"x": 0.0859375,
|
||
|
"y": 0.37819010416666665,
|
||
|
"width": 0.859375,
|
||
|
"height": 0.065625,
|
||
|
"type": "li"
|
||
|
},
|
||
|
{
|
||
|
"x": 0.0859375,
|
||
|
"y": 0.4583984375,
|
||
|
"width": 0.859375,
|
||
|
"height": 0.065625,
|
||
|
"type": "li"
|
||
|
},
|
||
|
{
|
||
|
"x": 0.0859375,
|
||
|
"y": 0.5386067708333333,
|
||
|
"width": 0.859375,
|
||
|
"height": 0.065625,
|
||
|
"type": "li"
|
||
|
}
|
||
|
]
|
||
|
```
|