Shafayat Alam Shafayat Alam - 1 year ago 184
Node.js Question

jQuery with slenium-webdriver in Node.JS

Can anyone please tell me how to use jQuery with selenium-webdriver to scrape some web page with Node.JS

My current code looks like this

driver.get(args.bookingURL).then(function () {
return driver.executeScript("\
}).then(function () {
console.log('Button Will be Clicked');
return driver.executeScript("$('#customer_login').click();");

When I execute this script terminal shows this

JavascriptError: $ is not defined

Answer Source

use the script like below:

driver.executeScript("$('#customer_login_email').val(''); "
            + "$('#customer_login_password').val('*******');");

when you enter script in new line you have to add an extra + in your script.

u can go through this page to check how to add jquery in DOM

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download