Skip to content

A barebones mock selenium server (but easily extensible!)

License

Notifications You must be signed in to change notification settings

sjelin/selenium-mock

Repository files navigation

Selenium Mock

This is an extremely barebones mock selenium server. Out of the box, it only supports status and creating/closing/describing/listing sessions. The idea is for you to add your own commands as needed:

import {Server, Session as BasicSession, Command} from 'selenium-mock';

interface Session extends BasicSession {
  url: string
}
// Support for webdriver.WebDriver.prototype.get
let setUrl = new Command<MySession>('POST', 'url', (session, params) => {
  session.url = params['url'];
});
// Support for webdriver.WebDriver.prototype.getCurrentUrl
let getUrl = new Command<MySession>('GET', 'url', (session, params) => {
  return session.url;
});

let server = new Server<Session>(4444);
server.addCommand(setUrl);
server.addCommand(getUrl);
server.start();

See spec/custom_command_spec.ts for an example

About

A barebones mock selenium server (but easily extensible!)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published