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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

nakachari2015

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.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/81acd975-36ca-4813-bbea-aa46e5f9fd3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.