https://github.com/remarkablemark/webdriven
Helpers for selenium-webdriver.
https://github.com/remarkablemark/webdriven
Last synced: 3 months ago
JSON representation
Helpers for selenium-webdriver.
- Host: GitHub
- URL: https://github.com/remarkablemark/webdriven
- Owner: remarkablemark
- License: mit
- Created: 2016-11-23T18:48:44.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-01T01:12:41.000Z (over 8 years ago)
- Last Synced: 2025-01-14T03:55:56.299Z (5 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/webdriven
- Size: 26.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# webdriven
[](https://nodei.co/npm/webdriven/)
[](https://www.npmjs.com/package/webdriven)
[](https://travis-ci.org/remarkablemark/webdriven)
[](https://coveralls.io/github/remarkablemark/webdriven?branch=master)Helpers for [selenium-webdriver](https://www.npmjs.com/package/selenium-webdriver).
## Install
```sh
$ npm install webdriven
```## Getting Started
Require the package and build a driver:
```js
var webdriven = require('webdriven');
var driver = webdriven.build('chrome');
```Now you can open a webpage:
```js
driver.get('http://example.com');
```## Helpers
Initialize the helpers by invoking `webdriven` with `driver`:
```js
var helpers = webdriven(driver);
```#### findElement(locator[, timeout])
```js
helpers.findElement('h1');
```#### findElements(locator)
```js
helpers.findElements('p');
```Check if an element is found:
```js
helpers
.findElements('#no-such-element')
.then(function(elements) {
if (elements.length > 0) {
// at least 1 element found
} else {
// element not found
}
});
```#### saveScreenshot(filename, callback)
```js
helpers.saveScreenshot('filename.png', function(error) {
if (error) throw error;
console.log('Screenshot saved successfully');
});
```## Testing
```sh
$ npm test
$ npm run lint
```## License
[MIT](https://github.com/remarkablemark/webdriven/blob/master/LICENSE)