#selenium #side #automation #automation-selenium

siderunner

A library for execution of .side files produced by Selenium IDE

2 unstable releases

0.2.0 Jul 10, 2021
0.1.0 Jul 4, 2021

#463 in Testing

MPL-2.0 license

205KB
5K SLoC

Build Status Crates.io Docs.rs CodeCov License:MPL-2.0

Siderunner

A library for parsing and running selenium .side files used in a Selenium IDE.

Get started

To run a file you should initially parse it and then you can run a test by its index.

use siderunner::{parse, Runner};
use thirtyfour::{DesiredCapabilities, WebDriver};
use serde_json::json;

let wiki = std::fs::File::open("examples/wiki.side").expect("Can't open a side file");
let file = parse(wiki).expect("parsing can't be done...");

let client = WebDriver::new("http://localhost:4444", DesiredCapabilities::firefox())
    .await
    .expect("can't connect to webdriver");

let mut runner = Runner::new(&client);
runner.run(&file).await.expect("Error occured while running a side file");

assert_eq!(
    runner.get_value("slogan"),
    Some(&json!("The Free Encyclopedia")),
);

runner.close().await.unwrap();

A .side file for the example can be found in example directory.

Backends

siderunner supports 2 backends:

You can tweak fantoccini backend by providing a feature fantoccini_backend and turn off default features, default-features = false

Supported commands

Selenium IDE supports the following commands.

  • add selection
  • answer on next prompt
  • assert
  • assert alert
  • assert checked
  • assert confirmation
  • assert editable
  • assert element present
  • assert element not present
  • assert not checked
  • assert not editable
  • assert not selected value
  • assert not text
  • assert prompt
  • assert selected value
  • assert selected label
  • assert text
  • assert title
  • assert value
  • check
  • choose cancel on next confirmation
  • choose cancel on next prompt
  • choose ok on next confirmation
  • click
  • click at
  • close
  • debugger
  • do
  • double click
  • double click at
  • drag and drop to object
  • echo
  • edit content
  • else
  • else if
  • end
  • execute script
  • execute async script
  • for each
  • if
  • mouse down
  • mouse down at
  • mouse move at
  • mouse out
  • mouse over
  • mouse up
  • mouse up at
  • open
  • pause
  • remove selection
  • repeat if
  • run
  • run script
  • select
  • select frame
  • select window
  • send keys
  • set speed
  • set window size
  • store
  • store attribute
  • store json
  • store text
  • store title
  • store value
  • store window handle
  • store xpath count
  • submit
  • times
  • type
  • uncheck
  • verify
  • verify checked
  • verify editable
  • verify element present
  • verify element not present
  • verify not checked
  • verify not editable
  • verify not selected value
  • verify not text
  • verify selected label
  • verify selected value
  • verify text
  • verify title
  • verify value
  • wait for element editable
  • wait for element not editable
  • wait for element not present
  • wait for element not visible
  • wait for element present
  • wait for element visible
  • webdriver answer on visible prompt
  • webdriver choose cancel on visible confirmation
  • webdriver choose cancel on visible prompt
  • webdriver choose ok on visible confirmation
  • while

Development

Unit tests

cargo test --lib

Integrational tests

To run a integration test suit you must set an environment. You can use test.bash file to run tests and manage the environment. Just run it.

./test.bash

Requirements

  • docker-compose

Contributing

All contributions are welcomed.

I would recomend to start by tackling some of not implemented commands. And there's one more good place to start is fantoccini backend, as it got a bit outdated as there's a bunch of not implemented commands there compared to default backend.

There might be something to do in the backend repos so you can help them out as well.

Dependencies

~5–10MB
~210K SLoC