https://github.com/ubidots/docker-selenium-screenshot
https://github.com/ubidots/docker-selenium-screenshot
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ubidots/docker-selenium-screenshot
- Owner: ubidots
- License: mit
- Created: 2020-04-24T17:31:51.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-22T07:27:10.000Z (over 2 years ago)
- Last Synced: 2023-06-14T20:25:26.277Z (almost 2 years ago)
- Language: Python
- Size: 23.4 KB
- Stars: 1
- Watchers: 12
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.