Selenium Compose
Selenium Compose description driven selenium tests composition
Installation
First install Selenium Standalone and start Selenium Server
npm install selenium-standalone@latest -g
selenium-standalone install && selenium-standalone start
npm install selenium-compose
selenium-compose doc title
Overview
- Code-free selenium tests composition
- Intuitive syntax
- Debug-friendly
- Readable logs
- Reusable components
- Developer friendly
- Pitfalls-free
- Hassle-free
Get Started
- Selenium Compose Guides https://selenium-compose.io
Example
Testing Golang
variables:
golang_url: "https://golang.org"
scenarios:
golang_org:
actions:
- open:
url: $golang_url
timeout: 20s
- wait:
- title:
is: the go programming language
ignore_case: true
- click:
location: "#learn .run"
- wait:
- text:
location: .stdout
is: "Hello, 世界"
- type:
location: "#learn select"
keys: "fib.go"
- pause: 400ms
- move_to: "#learn .run"
- click:
- wait:
- text:
location: .stdout
is: "1 1 2 3 5"
timeout: 50s
- click: "#learn .buttons a.share"
- wait:
title: The Go Playground
- clear:
location: code
selector: id
- type:
location: code
selector: id
keys:
>
package main
import (
"fmt"
"time"
)
func main() {
time.Sleep(time.Second)
fmt.Print("Voila!")
}
- pause: 2s
- click:
location: "#run"
- wait:
- text:
location: "#output .stdout"
is: Voila!
timeout: 2m
Debug mode
Commands
Run
Run executes all scenarios described in yml files
$ selenium-compose run [scenarios yml file]
Flag | Default | Description |
---|---|---|
-u --hub
|
:4444/wd/hub |
Selenium hub url |
-d --debug
|
false |
Run in debug mode |
-s --selector
|
css |
Default selector. One of {xpath, id, name, tag, class, css} |
-t --timeout
|
2 min |
Maximum timeout for conditions to be satisfied |
-l --length
|
unlimited |
Maximum execution time after which all remained tests will be terminated |
-l --scenario-length
|
unlimited |
Maximum execution time for each scenario after which the scenario will be terminated |
-f --filter
|
"" |
Filter out scenarios to be run by name |
-e --exit-on-failure
|
false |
Terminate all running tests if any test failed |
-n --parallel
|
100 |
Maximum simultaneously running tests count |
-o --output
|
./out |
Output dir for logs, screenshots, etc... |
-p --pwd
|
. |
Current working dir, all paths are relative to the working dir |
--retry-count |
5 | Attempts count to create a new session |
--retry-interval |
30 sec | Attempts interval to create a new session |
--browser |
chrome |
The name of the browser |
--version |
"Unknown" |
The browser version |
--platform |
ANY |
Flag specifying which platform the browser should be running on |
Issues
If you encounter any problems when using Selenium Compose, raise an issue on GitHub or contact us on Slack. ˜