Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

selenium-node-webdriver

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

selenium-node-webdriver

Node.js WebDriver client from the Selenium project

Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
35
169.23%
Maintainers
1
Weekly downloads
 
Created
Source

selenium-node-webdriver

Drive PhantomJS 1.8+ from Node.js using Selenium's WebDriver

This repo is simply a pre-built Selenium WebDriver.

Usage

npm install selenium-node-webdriver
phantomjs --webdriver=4444 &
node node_modules/selenium-node-webdriver/examples/hello.js

examples/hello.js

var webdriver = require('selenium-node-webdriver');

var driver = new webdriver.Builder().
    usingServer('http://localhost:4444/wd/hub').
    withCapabilities({
      'browserName': 'phantomjs',
      'version': '',
      'platform': 'ANY',
      'javascriptEnabled': true
    }).
    build();

driver.get('http://www.google.com').
    then(function () {
        return driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');
    }).
    then(function () {
        return driver.findElement(webdriver.By.name('btnG')).click();
    }).
    then(function () {
        return driver.getTitle();
    }).
    then(function (title) {
        console.log('Title:', title);
        driver.quit();
    });

FAQs

Package last updated on 02 Feb 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts