Uncaught Error: process.binding is not supported (browserify+selenium-webdriver)

446 views
Skip to first unread message

nakach...@gmail.com

unread,
Jun 12, 2017, 11:52:46 PM6/12/17
to Selenium Users

I am trying to run a node js code in my browser i.e. client side. I am using browserify to convert my code to browser compatible code. My code below uses selenium web-driver and cheerio. I use this command to convert it

browserify test.js -o btest.js

My code looks like this:

var cheerio = require('cheerio');
var webdriver = require('selenium-webdriver'),
    By = webdriver.By,
    until = webdriver.until;
var driver = new webdriver.Builder()
    .forBrowser('chrome')
    .build();


function getdata(email,username,password,callBack,errCallBack){

var url = 'https://www.linkedin.com/in/'+username;
driver.get('https://www.linkedin.com/');
driver.findElement(By.xpath('//*[@id="login-email"]')).sendKeys(email);
driver.findElement(By.xpath('//*[@id="login-password"]')).sendKeys(password);
driver.findElement(By.xpath('//*[@id="login-submit"]')).click();

driver.get(url);
attr={};
driver.findElement(By.className('profile-view-grid')).getAttribute("innerHTML").then(function(profile) { 
    var $= cheerio.load(profile);
    attr['ResearchInterest']=$('h2.pv-top-card-section__headline').text().trim();
});

callBack(attr);


}

When I include the btest.js in my html code and try to run it I get the error:

 Uncaught Error: process.binding is not supported

and

Uncaught ReferenceError: getdata is not defined

I am not sure what the problem is. Is it that my conversion using browserify is incorrect or if selenium web driver cannot run in the browser using browserify? If so what are my options. Any helpful article or blogpost having similar examples is highly appreciated.

Reply all
Reply to author
Forward
0 new messages