mirror of
https://github.com/vimagick/dockerfiles.git
synced 2024-11-28 09:08:36 +02:00
add selenium
This commit is contained in:
parent
d0dfd4f0e4
commit
9109980de6
@ -55,6 +55,7 @@ dockerfiles
|
||||
- [x] privoxy
|
||||
- [x] proxyhub
|
||||
- [x] pure-ftpd
|
||||
- [x] revive
|
||||
- [x] rsyncd
|
||||
- [x] samba :beetle:
|
||||
- [x] scrapyd :+1:
|
||||
@ -86,5 +87,9 @@ dockerfiles
|
||||
- [x] owncloud
|
||||
- [x] rocket.chat
|
||||
- [x] scrapinghub/splash
|
||||
- [ ] selenium
|
||||
- [ ] hub
|
||||
- [ ] node-firefox
|
||||
- [x] standalone-firefox
|
||||
- [x] tutum/builder
|
||||
|
||||
|
52
selenium/README.md
Normal file
52
selenium/README.md
Normal file
@ -0,0 +1,52 @@
|
||||
selenium
|
||||
========
|
||||
|
||||
[Selenium][1] is an umbrella project for a range of tools and libraries that enable
|
||||
and support the automation of web browsers.
|
||||
|
||||
## Server
|
||||
|
||||
docker-compose.yml
|
||||
|
||||
```
|
||||
firefox:
|
||||
image: selenium/standalone-firefox
|
||||
ports:
|
||||
- "4444:4444"
|
||||
environment:
|
||||
- JAVA_OPTS=-Xmx512m
|
||||
restart: always
|
||||
```
|
||||
|
||||
```
|
||||
$ docker-compose up -d
|
||||
```
|
||||
|
||||
## Client
|
||||
|
||||
demo.py
|
||||
|
||||
```
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
||||
|
||||
driver = webdriver.Remote(
|
||||
command_executor='http://127.0.0.1:4444/wd/hub',
|
||||
desired_capabilities=DesiredCapabilities.FIREFOX
|
||||
)
|
||||
|
||||
driver.get('https://github.com/SeleniumHQ/docker-selenium')
|
||||
driver.save_screenshot('before-click.png')
|
||||
driver.find_element_by_css_selector('.author>a').click()
|
||||
driver.save_screenshot('after-click.png')
|
||||
```
|
||||
|
||||
```
|
||||
$ pip3 install selenium
|
||||
$ python3 demo.py
|
||||
$ ls *.png
|
||||
```
|
||||
|
||||
[1]: http://seleniumhq.org/
|
7
selenium/docker-compose.yml
Normal file
7
selenium/docker-compose.yml
Normal file
@ -0,0 +1,7 @@
|
||||
firefox:
|
||||
image: selenium/standalone-firefox
|
||||
ports:
|
||||
- "4444:4444"
|
||||
environment:
|
||||
- JAVA_OPTS=-Xmx512m
|
||||
restart: always
|
Loading…
Reference in New Issue
Block a user