WebDriverJS Recipes (Selenium for Node.js)
MIT License
Recipes and examples of how to perform automation with WebDriverJS (Selenium for Node.js).
See API documentation for more information on selenium-webdriver.
brew install node
nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
brew install yarn
brew cask install google-chrome
brew install chromedriver
brew cask install firefox
brew cask install geckodriver
Clone the repository:
git clone https://github.com/remarkablemark/webdriverjs-recipes.git && cd webdriverjs-recipes
Use Node.js version:
nvm use
Install the dependencies:
yarn
In the project directory, you can run:
yarn async-await
Automates a Firefox browser using async/await. See article.
yarn build
Builds driver with Firefox browser.
To build driver with Chrome browser:
SELENIUM_BROWSER=chrome yarn build
yarn chrome-profile
Launches Chrome profile page. See article.
The profile data is saved at ./my_profile_path/
.
yarn cucumber
Runs browser automation test written in Cucumber. See artcile.
yarn find
Finds elements. See article.
yarn jest
Runs browser automation test with Jest.
yarn mocha
Runs browser automation test with Mocha. See article.
yarn resources
Gets the browser resource file URL's of a webpage. See article.
yarn screenshot
Takes and saves a screenshot to ./screenshot.png
.
yarn wait-until
Waits until condition is true.