2019-11-03 06:01:33 +02:00
|
|
|
selenoid
|
|
|
|
========
|
|
|
|
|
|
|
|
[Selenoid][1] is a Golang implementation of Selenium protocol using Docker to launch
|
|
|
|
browser sessions (so it is a replacement of Java-based Selenium server).
|
|
|
|
Currently it supports working with Docker directly (no support for Swarm or
|
|
|
|
Kubernetes).
|
|
|
|
|
|
|
|
|
|
|
|
Directory Tree
|
|
|
|
--------------
|
|
|
|
|
|
|
|
```
|
|
|
|
selenoid/
|
|
|
|
├── README.md
|
|
|
|
├── data/
|
|
|
|
│ ├── config/
|
|
|
|
│ │ └── browsers.json
|
|
|
|
│ ├── logs/
|
|
|
|
│ └── video/
|
|
|
|
└── docker-compose.yml
|
|
|
|
```
|
|
|
|
|
|
|
|
Required Images
|
|
|
|
---------------
|
|
|
|
|
|
|
|
- aerokube/selenoid:latest-release
|
|
|
|
- aerokube/selenoid-ui:latest-release
|
|
|
|
- selenoid/video-recorder:latest-release
|
2021-07-30 10:47:23 +02:00
|
|
|
- selenoid/chrome:92.0
|
|
|
|
- selenoid/firefox:90.0
|
|
|
|
- selenoid/opera:77.0
|
|
|
|
- selenoid/vnc:chrome_92.0
|
|
|
|
- selenoid/vnc:firefox_90.0
|
|
|
|
- selenoid/vnc:opera_77.0
|
2019-11-03 06:01:33 +02:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"chrome": {
|
2021-07-30 10:47:23 +02:00
|
|
|
"default": "92.0",
|
2019-11-03 06:01:33 +02:00
|
|
|
"versions": {
|
2021-07-30 10:47:23 +02:00
|
|
|
"92.0": {
|
|
|
|
"image": "selenoid/vnc:chrome_92.0",
|
2019-11-03 06:01:33 +02:00
|
|
|
"port": "4444"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"firefox": {
|
2021-07-30 10:47:23 +02:00
|
|
|
"default": "90.0",
|
2019-11-03 06:01:33 +02:00
|
|
|
"versions": {
|
2021-07-30 10:47:23 +02:00
|
|
|
"90.0": {
|
|
|
|
"image": "selenoid/vnc:firefox_90.0",
|
2021-06-01 05:40:12 +02:00
|
|
|
"port": "4444"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"opera": {
|
2021-07-30 10:47:23 +02:00
|
|
|
"default": "77.0",
|
2021-06-01 05:40:12 +02:00
|
|
|
"versions": {
|
2021-07-30 10:47:23 +02:00
|
|
|
"77.0": {
|
|
|
|
"image": "selenoid/vnc:opera_77.0",
|
2019-11-03 06:01:33 +02:00
|
|
|
"port": "4444"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```python
|
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
from selenium import webdriver
|
|
|
|
|
|
|
|
capabilities = {
|
|
|
|
"browserName": "chrome",
|
2021-07-30 10:47:23 +02:00
|
|
|
"version": "92.0",
|
2021-07-30 12:14:00 +02:00
|
|
|
"selenoid:options": {
|
|
|
|
"enableVNC": True,
|
|
|
|
"enableVideo": False,
|
|
|
|
},
|
|
|
|
"goog:chromeOptions": {
|
|
|
|
"args": ["--disable-gpu"],
|
|
|
|
},
|
2019-11-03 06:01:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
driver = webdriver.Remote(
|
|
|
|
command_executor="http://172.0.0.1:4444/wd/hub",
|
|
|
|
desired_capabilities=capabilities)
|
|
|
|
|
|
|
|
driver.maximize_window()
|
|
|
|
driver.get('https://www.google.com/')
|
|
|
|
driver.save_screenshot('google.png')
|
|
|
|
driver.close()
|
2019-11-03 10:54:00 +02:00
|
|
|
driver.quit()
|
2019-11-03 06:01:33 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
[1]: https://aerokube.com/selenoid/latest/
|