Selenium in node

Node.js is used to develop server side web applications using JavaScript. Node.js is a javascript run time environment. Node.js basically runs a javascript code. Node.js has an event driven architecture. Most of the methods are asynchronous. Key features of Node.js
  • Open source
  • Cross platform
  • Runs on Google’s V8 Javascript engine used in chrome browser
  • Allows you to execute Javascript on server
  • Uses event driven programming
  • NPM is used a package manager in Node.js

Editors for Nodejs

We can use the editors like visual studio, eclipse, Intellij etc to develop Node.js applications. You can also develop the code in simple notepad or notepad++. Node.js runs on single thread. Then obvious question you may ask is how it can support multiple requests? The main point here is that even though node.js runs on single thread, all requests are handled in asynchronous manner. For example – let us say we want to do 2 tasks
  • task1 – Read a file1
  • task2 – Write file2
As long as requests are not dependent on each other, Node.js will register a call back for both tasks. Both tasks will start running and whenever any of the task completion event occurs, node.js will invoke the call back function. When you use node.js as a server, this event loop never ends. In synchronous approach, task2 will be blocked until task1 finishes. But in asynchronous approach(node.js), task2 will not be blocked. Both tasks will be running in parallel. Both tasks register call back if any. At the end of the task completion, those call back methods are invoked. What if task2 depends on task1? In this case, you can use promises and Fibers

Complex problems, Simple Solutions