An open API service indexing awesome lists of open source software.

https://github.com/ubidots/docker-selenium-screenshot


https://github.com/ubidots/docker-selenium-screenshot

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

# docker-selenium-screenshot

Container for taking screenshots using selenium

## Allowed arguments
1. **url**: the URL of the page to take the screenshot
2. **file_name**: Name of the image which will be saved (e.g `/path/of/my/image.png`)
3. **width**: Initial width for the browser
4. **height**: Initial height for the browser
5. **app_selector_xpath** (*optional*): XPath selector for search the target content in the DOM. Default `//div[@id='root']`
6. **not_load_selector_xpath** (*optional*): XPath selector when it can't find the content. Default `div[contains(@class, 'selenium-data-not-loaded')]`
7. **timeout** (*optional*): The time to wait until the content load. Default `10s`

**Note**: Every argument is positional, each one must be sent in the order described above.

## Usage
To build the container, execute:
```
# Switch to Dockerfile path
cd docker-selenium-screenshot

# Run docker build
docker build --tag .
```

The container has a volume where it will put the screenshots took `tmp/assets`

```
docker run -v /tmp/assets:/tmp/assets -v /dev/shm:/dev/shm
```

e.g
```
docker run -v /tmp/assets:/tmp/assets -v /dev/shm:/dev/shm https://ubidots.com /tmp/assets/ubidots.png "1000" "500" "//body" "//target"
```

**Note**: When executing docker run include `-v /dev/shm:/dev/shm` to use the host's shared memory.