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.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/4162847c-8716-461b-bed0-3f487131128b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to