Ensure you check out webdriver-manager, the selenium server, and browser driver manager for your end-to-end tests just like webdriver-manager
from the Protractor repository.
To utilize as a command line interface:
npm i -g webdriver-manager
webdriver-manager update // Fetches the newest binaries.
webdriver-manager start // Initiates the standalone selenium server.
To set it up as a dependency:
npm install -D webdriver-manager
An illustration of running webdriver-manager as a dependency:
import {
Options,
setLogLevel,
shutdown,
start,
update,
} from 'webdriver-manager';
const options: Options = {
browserDrivers: [{
name: 'chromedriver' // For browser drivers, we simply need to specify a valid
// browser driver name. Other potential values
// include 'geckodriver' and 'iedriver'.
}],
server: {
name: 'selenium',
runAsNode: true, // If we wish to operate as a node. By default
// operating as detached will automatically set this to true.
runAsDetach: true // To execute this in detached mode. This sends back the
// process to the parent process.
}
};
setLogLevel('info'); // Necessary if we want webdriver-manager to log messages
// to the console. Omitting this hides the logs.
describe('some web test', () => {
beforeAll(async () => {
await update(options);
await start(options);
});
it('should perform some web test', async () => {
// Your asynchronous web test using any framework.
});
afterAll(async () => {
await shutdown(options); // Sends the web request to shut down the server.
// Without calling shutdown, the java command
// will keep running the server on port 4444.
});
});