mirror of
https://github.com/vimagick/dockerfiles.git
synced 2025-12-21 13:23:02 +01:00
update selenium (timeout in seconds)
This commit is contained in:
@@ -21,7 +21,7 @@ firefox:
|
|||||||
restart: always
|
restart: always
|
||||||
```
|
```
|
||||||
|
|
||||||
docker-compose-grid.yml (not tested yet)
|
docker-compose-hub.yml
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
hub:
|
hub:
|
||||||
@@ -29,6 +29,9 @@ hub:
|
|||||||
container_name: hub
|
container_name: hub
|
||||||
ports:
|
ports:
|
||||||
- "4444:4444"
|
- "4444:4444"
|
||||||
|
environment:
|
||||||
|
- GRID_TIMEOUT=60
|
||||||
|
- GRID_BROWSER_TIMEOUT=30
|
||||||
retart: always
|
retart: always
|
||||||
|
|
||||||
chrome:
|
chrome:
|
||||||
@@ -52,13 +55,31 @@ firefox:
|
|||||||
|
|
||||||
> Access grid console at <http://127.0.0.1:4444/grid/console>
|
> Access grid console at <http://127.0.0.1:4444/grid/console>
|
||||||
|
|
||||||
|
docker-compose-node.yml
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
firefox:
|
||||||
|
image: selenium/node-firefox
|
||||||
|
ports:
|
||||||
|
- "5555:5555"
|
||||||
|
- "5900:5900"
|
||||||
|
environment:
|
||||||
|
- JAVA_OPTS=-Xmx512m
|
||||||
|
- NODE_MAX_INSTANCES=2
|
||||||
|
- NODE_MAX_SESSION=2
|
||||||
|
- SE_OPTS=-host 5.6.7.8 -port 5555
|
||||||
|
- HUB_PORT_4444_TCP_ADDR=1.2.3.4
|
||||||
|
- HUB_PORT_4444_TCP_PORT=4444
|
||||||
|
restart: always
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker-compose up -d
|
$ docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
> Another way to start selenium server:
|
> Another way to start selenium server:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ npm install -g selenium-standalone
|
$ npm install -g selenium-standalone
|
||||||
$ selenium-standalone install
|
$ selenium-standalone install
|
||||||
$ selenium-standalone start
|
$ selenium-standalone start
|
||||||
@@ -68,7 +89,7 @@ $ selenium-standalone start
|
|||||||
|
|
||||||
baidu-search.py
|
baidu-search.py
|
||||||
|
|
||||||
```
|
```python
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
||||||
|
|
||||||
@@ -86,7 +107,7 @@ driver.close()
|
|||||||
|
|
||||||
search-baidu.js
|
search-baidu.js
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
var webdriver = require('selenium-webdriver'),
|
var webdriver = require('selenium-webdriver'),
|
||||||
By = require('selenium-webdriver').By,
|
By = require('selenium-webdriver').By,
|
||||||
until = require('selenium-webdriver').until,
|
until = require('selenium-webdriver').until,
|
||||||
@@ -113,7 +134,7 @@ driver.saveScreenshot('baidu.png');
|
|||||||
driver.quit();
|
driver.quit();
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```bash
|
||||||
# VNC
|
# VNC
|
||||||
$ open vnc://:secret@127.0.0.1:5900
|
$ open vnc://:secret@127.0.0.1:5900
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ hub:
|
|||||||
ports:
|
ports:
|
||||||
- "4444:4444"
|
- "4444:4444"
|
||||||
environment:
|
environment:
|
||||||
- GRID_TIMEOUT=30000
|
- GRID_TIMEOUT=60
|
||||||
- GRID_BROWSER_TIMEOUT=30000
|
- GRID_BROWSER_TIMEOUT=30
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
firefox:
|
firefox:
|
||||||
|
|||||||
Reference in New Issue
Block a user